Commit 4075c6b2 authored by Nikolay's avatar Nikolay

Performance improvement of the Logger. Ubiquitous string concatenation when the…

Performance improvement of the Logger. Ubiquitous string concatenation when the logger is off is now avoided.
parent 5c5c8cd5
......@@ -383,12 +383,12 @@ public class Datacenter extends SimEntity {
status = getVmAllocationPolicy().getHost(vmId, userId).getVm(vmId,userId)
.getCloudletScheduler().getCloudletStatus(cloudletId);
} catch (Exception e) {
Log.printLine(getName() + ": Error in processing CloudSimTags.CLOUDLET_STATUS");
Log.printConcatLine(getName(), ": Error in processing CloudSimTags.CLOUDLET_STATUS");
Log.printLine(e.getMessage());
return;
}
} catch (Exception e) {
Log.printLine(getName() + ": Error in processing CloudSimTags.CLOUDLET_STATUS");
Log.printConcatLine(getName(), ": Error in processing CloudSimTags.CLOUDLET_STATUS");
Log.printLine(e.getMessage());
return;
}
......@@ -412,7 +412,7 @@ public class Datacenter extends SimEntity {
*/
protected void processOtherEvent(SimEvent ev) {
if (ev == null) {
Log.printLine(getName() + ".processOtherEvent(): Error - an event is null.");
Log.printConcatLine(getName(), ".processOtherEvent(): Error - an event is null.");
}
}
......@@ -560,12 +560,12 @@ public class Datacenter extends SimEntity {
userId = cl.getUserId();
vmId = cl.getVmId();
} catch (Exception e) {
Log.printLine(super.getName() + ": Error in processing Cloudlet");
Log.printConcatLine(super.getName(), ": Error in processing Cloudlet");
Log.printLine(e.getMessage());
return;
}
} catch (Exception e) {
Log.printLine(super.getName() + ": Error in processing a Cloudlet.");
Log.printConcatLine(super.getName(), ": Error in processing a Cloudlet.");
Log.printLine(e.getMessage());
return;
}
......@@ -685,8 +685,8 @@ public class Datacenter extends SimEntity {
// checks whether this Cloudlet has finished or not
if (cl.isFinished()) {
String name = CloudSim.getEntityName(cl.getUserId());
Log.printLine(getName() + ": Warning - Cloudlet #" + cl.getCloudletId() + " owned by " + name
+ " is already completed/finished.");
Log.printConcatLine(getName(), ": Warning - Cloudlet #", cl.getCloudletId(), " owned by ", name,
" is already completed/finished.");
Log.printLine("Therefore, it is not being executed again");
Log.printLine();
......@@ -1015,7 +1015,7 @@ public class Datacenter extends SimEntity {
*/
@Override
public void shutdownEntity() {
Log.printLine(getName() + " is shutting down...");
Log.printConcatLine(getName(), " is shutting down...");
}
/*
......@@ -1024,7 +1024,7 @@ public class Datacenter extends SimEntity {
*/
@Override
public void startEntity() {
Log.printLine(getName() + " is starting...");
Log.printConcatLine(getName(), " is starting...");
// this resource should register to regional GIS.
// However, if not specified, then register to system GIS (the
// default CloudInformationService) entity.
......
......@@ -200,8 +200,8 @@ public class DatacenterBroker extends SimEntity {
setDatacenterIdsList(CloudSim.getCloudResourceList());
setDatacenterCharacteristicsList(new HashMap<Integer, DatacenterCharacteristics>());
Log.printLine(CloudSim.clock() + ": " + getName() + ": Cloud Resource List received with "
+ getDatacenterIdsList().size() + " resource(s)");
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Cloud Resource List received with ",
getDatacenterIdsList().size(), " resource(s)");
for (Integer datacenterId : getDatacenterIdsList()) {
sendNow(datacenterId, CloudSimTags.RESOURCE_CHARACTERISTICS, getId());
......@@ -224,12 +224,12 @@ public class DatacenterBroker extends SimEntity {
if (result == CloudSimTags.TRUE) {
getVmsToDatacentersMap().put(vmId, datacenterId);
getVmsCreatedList().add(VmList.getById(getVmList(), vmId));
Log.printLine(CloudSim.clock() + ": " + getName() + ": VM #" + vmId
+ " has been created in Datacenter #" + datacenterId + ", Host #"
+ VmList.getById(getVmsCreatedList(), vmId).getHost().getId());
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": VM #", vmId,
" has been created in Datacenter #", datacenterId, ", Host #",
VmList.getById(getVmsCreatedList(), vmId).getHost().getId());
} else {
Log.printLine(CloudSim.clock() + ": " + getName() + ": Creation of VM #" + vmId
+ " failed in Datacenter #" + datacenterId);
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Creation of VM #", vmId,
" failed in Datacenter #", datacenterId);
}
incrementVmsAcks();
......@@ -270,11 +270,11 @@ public class DatacenterBroker extends SimEntity {
protected void processCloudletReturn(SimEvent ev) {
Cloudlet cloudlet = (Cloudlet) ev.getData();
getCloudletReceivedList().add(cloudlet);
Log.printLine(CloudSim.clock() + ": " + getName() + ": Cloudlet " + cloudlet.getCloudletId()
+ " received");
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Cloudlet ", cloudlet.getCloudletId(),
" received");
cloudletsSubmitted--;
if (getCloudletList().size() == 0 && cloudletsSubmitted == 0) { // all cloudlets executed
Log.printLine(CloudSim.clock() + ": " + getName() + ": All Cloudlets executed. Finishing...");
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": All Cloudlets executed. Finishing...");
clearDatacenters();
finishExecution();
} else { // some cloudlets haven't finished yet
......@@ -298,12 +298,11 @@ public class DatacenterBroker extends SimEntity {
*/
protected void processOtherEvent(SimEvent ev) {
if (ev == null) {
Log.printLine(getName() + ".processOtherEvent(): " + "Error - an event is null.");
Log.printConcatLine(getName(), ".processOtherEvent(): ", "Error - an event is null.");
return;
}
Log.printLine(getName() + ".processOtherEvent(): "
+ "Error - event unknown by this DatacenterBroker.");
Log.printConcatLine(getName(), ".processOtherEvent(): Error - event unknown by this DatacenterBroker.");
}
/**
......@@ -348,15 +347,18 @@ public class DatacenterBroker extends SimEntity {
vm = getVmsCreatedList().get(vmIndex);
} else { // submit to the specific vm
vm = VmList.getById(getVmsCreatedList(), cloudlet.getVmId());
if (vm == null) { // vm was not created
Log.printLine(CloudSim.clock() + ": " + getName() + ": Postponing execution of cloudlet "
+ cloudlet.getCloudletId() + ": bount VM not available");
if (vm == null && !Log.isDisabled()) { // vm was not created
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Postponing execution of cloudlet ",
cloudlet.getCloudletId(), ": bount VM not available");
continue;
}
}
Log.printLine(CloudSim.clock() + ": " + getName() + ": Sending cloudlet "
+ cloudlet.getCloudletId() + " to VM #" + vm.getId());
if (!Log.isDisabled()) {
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Sending cloudlet ",
cloudlet.getCloudletId(), " to VM #", vm.getId());
}
cloudlet.setVmId(vm.getId());
sendNow(getVmsToDatacentersMap().get(vm.getId()), CloudSimTags.CLOUDLET_SUBMIT, cloudlet);
cloudletsSubmitted++;
......@@ -377,7 +379,7 @@ public class DatacenterBroker extends SimEntity {
*/
protected void clearDatacenters() {
for (Vm vm : getVmsCreatedList()) {
Log.printLine(CloudSim.clock() + ": " + getName() + ": Destroying VM #" + vm.getId());
Log.printConcatLine(CloudSim.clock(), ": " + getName(), ": Destroying VM #", vm.getId());
sendNow(getVmsToDatacentersMap().get(vm.getId()), CloudSimTags.VM_DESTROY, vm);
}
......@@ -400,7 +402,7 @@ public class DatacenterBroker extends SimEntity {
*/
@Override
public void shutdownEntity() {
Log.printLine(getName() + " is shutting down...");
Log.printConcatLine(getName(), " is shutting down...");
}
/*
......@@ -409,7 +411,7 @@ public class DatacenterBroker extends SimEntity {
*/
@Override
public void startEntity() {
Log.printLine(getName() + " is starting...");
Log.printConcatLine(getName(), " is starting...");
schedule(getId(), 0, CloudSimTags.RESOURCE_CHARACTERISTICS_REQUEST);
}
......
......@@ -356,7 +356,7 @@ public class HarddriveStorage implements Storage {
// check first whether file name is valid or not
File obj = null;
if (fileName == null || fileName.length() == 0) {
Log.printLine(name + ".getFile(): Warning - invalid " + "file name.");
Log.printConcatLine(name, ".getFile(): Warning - invalid " + "file name.");
return obj;
}
......@@ -450,13 +450,13 @@ public class HarddriveStorage implements Storage {
private boolean isFileValid(File file, String methodName) {
if (file == null) {
Log.printLine(name + "." + methodName + ": Warning - the given file is null.");
Log.printConcatLine(name, ".", methodName, ": Warning - the given file is null.");
return false;
}
String fileName = file.getName();
if (fileName == null || fileName.length() == 0) {
Log.printLine(name + "." + methodName + ": Warning - invalid file name.");
Log.printConcatLine(name, "." + methodName, ": Warning - invalid file name.");
return false;
}
......@@ -482,7 +482,7 @@ public class HarddriveStorage implements Storage {
// check the capacity
if (file.getSize() + currentSize > capacity) {
Log.printLine(name + ".addFile(): Warning - not enough space" + " to store " + file.getName());
Log.printConcatLine(name, ".addFile(): Warning - not enough space to store ", file.getName());
return result;
}
......@@ -512,7 +512,7 @@ public class HarddriveStorage implements Storage {
public double addFile(List<File> list) {
double result = 0.0;
if (list == null || list.isEmpty()) {
Log.printLine(name + ".addFile(): Warning - list is empty.");
Log.printConcatLine(name, ".addFile(): Warning - list is empty.");
return result;
}
......@@ -607,7 +607,7 @@ public class HarddriveStorage implements Storage {
public boolean contains(String fileName) {
boolean result = false;
if (fileName == null || fileName.length() == 0) {
Log.printLine(name + ".contains(): Warning - invalid file name");
Log.printConcatLine(name, ".contains(): Warning - invalid file name");
return result;
}
// check each file in the list
......
......@@ -115,14 +115,14 @@ public class Host {
if (!getVmsMigratingIn().contains(vm)) {
if (getStorage() < vm.getSize()) {
Log.printLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.getId() + " to Host #"
+ getId() + " failed by storage");
Log.printConcatLine("[VmScheduler.addMigratingInVm] Allocation of VM #", vm.getId(), " to Host #",
getId(), " failed by storage");
System.exit(0);
}
if (!getRamProvisioner().allocateRamForVm(vm, vm.getCurrentRequestedRam())) {
Log.printLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.getId() + " to Host #"
+ getId() + " failed by RAM");
Log.printConcatLine("[VmScheduler.addMigratingInVm] Allocation of VM #", vm.getId(), " to Host #",
getId(), " failed by RAM");
System.exit(0);
}
......@@ -202,27 +202,27 @@ public class Host {
*/
public boolean vmCreate(Vm vm) {
if (getStorage() < vm.getSize()) {
Log.printLine("[VmScheduler.vmCreate] Allocation of VM #" + vm.getId() + " to Host #" + getId()
+ " failed by storage");
Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(),
" failed by storage");
return false;
}
if (!getRamProvisioner().allocateRamForVm(vm, vm.getCurrentRequestedRam())) {
Log.printLine("[VmScheduler.vmCreate] Allocation of VM #" + vm.getId() + " to Host #" + getId()
+ " failed by RAM");
Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(),
" failed by RAM");
return false;
}
if (!getBwProvisioner().allocateBwForVm(vm, vm.getCurrentRequestedBw())) {
Log.printLine("[VmScheduler.vmCreate] Allocation of VM #" + vm.getId() + " to Host #" + getId()
+ " failed by BW");
Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(),
" failed by BW");
getRamProvisioner().deallocateRamForVm(vm);
return false;
}
if (!getVmScheduler().allocatePesForVm(vm, vm.getCurrentRequestedMips())) {
Log.printLine("[VmScheduler.vmCreate] Allocation of VM #" + vm.getId() + " to Host #" + getId()
+ " failed by MIPS");
Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(),
" failed by MIPS");
getRamProvisioner().deallocateRamForVm(vm);
getBwProvisioner().deallocateBwForVm(vm);
return false;
......
......@@ -28,6 +28,9 @@ public class Log {
/** The disable output flag. */
private static boolean disabled;
/** Buffer to avoid creating new string builder upon every print. */
private static StringBuilder buffer = new StringBuilder();
/**
* Prints the message.
......@@ -75,17 +78,52 @@ public class Log {
}
}
/**
* Prints the concatenated text representation of the arguements.
*
* @param messages the messages to print
*/
public static void printConcat(Object... messages) {
if (!isDisabled()) {
buffer.setLength(0); // Clear the buffer
for(int i = 0 ; i < messages.length ; i ++) {
buffer.append(String.valueOf(messages[i]));
}
print(buffer);
}
}
/**
* Prints the concatenated text representation of the arguements and a new line.
*
* @param messages the messages to print
*/
public static void printConcatLine(Object... messages) {
if (!isDisabled()) {
buffer.setLength(0); // Clear the buffer
for(int i = 0 ; i < messages.length ; i ++) {
buffer.append(String.valueOf(messages[i]));
}
printLine(buffer);
}
}
/**
* Prints the line passed as a non-String object.
*
* @param message the message
*/
public static void printLine(Object message) {
if (!isDisabled()) {
printLine(String.valueOf(message));
}
if (!isDisabled()) {
printLine(String.valueOf(message));
}
}
/**
* Prints a string formated as in String.format().
*
......
......@@ -57,7 +57,7 @@ public class NetworkTopology {
* @post $none
*/
public static void buildNetworkTopology(String fileName) {
Log.printLine("Topology file: " + fileName);
Log.printConcatLine("Topology file: ", fileName);
// try to find the file
GraphReaderBrite reader = new GraphReaderBrite();
......@@ -178,15 +178,15 @@ public class NetworkTopology {
if (!map.containsValue(briteID)) { // this BRITE node was already mapped?
map.put(cloudSimEntityID, briteID);
} else {
Log.printLine("Error in network mapping. BRITE node " + briteID + " already in use.");
Log.printConcatLine("Error in network mapping. BRITE node ", briteID, " already in use.");
}
} else {
Log.printLine("Error in network mapping. CloudSim entity " + cloudSimEntityID
+ " already mapped.");
Log.printConcatLine("Error in network mapping. CloudSim entity ", cloudSimEntityID,
" already mapped.");
}
} catch (Exception e) {
Log.printLine("Error in network mapping. CloudSim node " + cloudSimEntityID
+ " not mapped to BRITE node " + briteID + ".");
Log.printConcatLine("Error in network mapping. CloudSim node ", cloudSimEntityID,
" not mapped to BRITE node ", briteID, ".");
}
}
}
......@@ -203,7 +203,7 @@ public class NetworkTopology {
try {
map.remove(cloudSimEntityID);
} catch (Exception e) {
Log.printLine("Error in network unmapping. CloudSim node: " + cloudSimEntityID);
Log.printConcatLine("Error in network unmapping. CloudSim node: ", cloudSimEntityID);
}
}
}
......
......@@ -120,7 +120,7 @@ public class SanStorage extends HarddriveStorage {
public double addFile(List<File> list) {
double result = 0.0;
if (list == null || list.size() == 0) {
Log.printLine(getName() + ".addFile(): Warning - list is empty.");
Log.printConcatLine(getName(), ".addFile(): Warning - list is empty.");
return result;
}
......
......@@ -149,7 +149,7 @@ public class VmSchedulerTimeShared extends VmScheduler {
break;
}
if (!peIterator.hasNext()) {
Log.printLine("There is no enough MIPS (" + mips + ") to accommodate VM " + vmUid);
Log.printConcatLine("There is no enough MIPS (", mips, ") to accommodate VM ", vmUid);
// System.exit(0);
}
pe = peIterator.next();
......
......@@ -237,8 +237,8 @@ public class CloudInformationService extends SimEntity {
*/
protected void processOtherEvent(SimEvent ev) {
if (ev == null) {
Log.printLine("CloudInformationService.processOtherEvent(): "
+ "Unable to handle a request since the event is null.");
Log.printConcatLine("CloudInformationService.processOtherEvent(): ",
"Unable to handle a request since the event is null.");
return;
}
......@@ -294,7 +294,7 @@ public class CloudInformationService extends SimEntity {
* @post $none
*/
private void notifyAllEntity() {
Log.printLine(super.getName() + ": Notify all CloudSim entities for shutting down.");
Log.printConcatLine(super.getName(), ": Notify all CloudSim entities for shutting down.");
signalShutdown(resList);
signalShutdown(gisList);
......
......@@ -183,7 +183,7 @@ public class CloudSim {
* @post $none
*/
public static double startSimulation() throws NullPointerException {
Log.printLine("Starting CloudSim version " + CLOUDSIM_VERSION_STRING);
Log.printConcatLine("Starting CloudSim version ", CLOUDSIM_VERSION_STRING);
try {
double clock = run();
......
......@@ -532,7 +532,7 @@ public abstract class SimEntity implements Cloneable {
}
if (entityId < 0) {
Log.printLine(getName() + ".send(): Error - " + "invalid entity id " + entityId);
Log.printConcatLine(getName(), ".send(): Error - " + "invalid entity id ", entityId);
return;
}
......
......@@ -205,7 +205,7 @@ public class PeList {
status = "WORKING";
}
Log.printLine(resName + " - Machine: " + hostId + " is " + status);
Log.printConcatLine(resName, " - Machine: ", hostId, " is ", status);
setStatusFailed(peList, failed);
}
......
......@@ -223,8 +223,8 @@ public class NetDatacenterBroker extends SimEntity {
setDatacenterIdsList(CloudSim.getCloudResourceList());
setDatacenterCharacteristicsList(new HashMap<Integer, DatacenterCharacteristics>());
Log.printLine(CloudSim.clock() + ": " + getName() + ": Cloud Resource List received with "
+ getDatacenterIdsList().size() + " resource(s)");
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Cloud Resource List received with ",
getDatacenterIdsList().size(), " resource(s)");
for (Integer datacenterId : getDatacenterIdsList()) {
sendNow(datacenterId, CloudSimTags.RESOURCE_CHARACTERISTICS, getId());
......@@ -254,7 +254,7 @@ public class NetDatacenterBroker extends SimEntity {
cloudletsSubmitted--;
// all cloudlets executed
if (getCloudletList().size() == 0 && cloudletsSubmitted == 0 && NetworkConstants.iteration > 10) {
Log.printLine(CloudSim.clock() + ": " + getName() + ": All Cloudlets executed. Finishing...");
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": All Cloudlets executed. Finishing...");
clearDatacenters();
finishExecution();
} else { // some cloudlets haven't finished yet
......@@ -279,12 +279,12 @@ public class NetDatacenterBroker extends SimEntity {
*/
protected void processOtherEvent(SimEvent ev) {
if (ev == null) {
Log.printLine(getName() + ".processOtherEvent(): " + "Error - an event is null.");
Log.printConcatLine(getName(), ".processOtherEvent(): Error - an event is null.");
return;
}
Log.printLine(getName() + ".processOtherEvent(): "
+ "Error - event unknown by this DatacenterBroker.");
Log.printConcatLine(getName(), ".processOtherEvent(): ",
"Error - event unknown by this DatacenterBroker.");
}
/**
......@@ -402,7 +402,7 @@ public class NetDatacenterBroker extends SimEntity {
*/
protected void clearDatacenters() {
for (Vm vm : getVmsCreatedList()) {
Log.printLine(CloudSim.clock() + ": " + getName() + ": Destroying VM #" + vm.getId());
Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Destroying VM #", vm.getId());
sendNow(getVmsToDatacentersMap().get(vm.getId()), CloudSimTags.VM_DESTROY, vm);
}
......@@ -425,7 +425,7 @@ public class NetDatacenterBroker extends SimEntity {
*/
@Override
public void shutdownEntity() {
Log.printLine(getName() + " is shutting down...");
Log.printConcatLine(getName(), " is shutting down...");
}
/*
......@@ -434,7 +434,7 @@ public class NetDatacenterBroker extends SimEntity {
*/
@Override
public void startEntity() {
Log.printLine(getName() + " is starting...");
Log.printConcatLine(getName(), " is starting...");
schedule(getId(), 0, CloudSimTags.RESOURCE_CHARACTERISTICS_REQUEST);
}
......
......@@ -147,8 +147,8 @@ public class NetworkDatacenter extends Datacenter {
// checks whether this Cloudlet has finished or not
if (cl.isFinished()) {
String name = CloudSim.getEntityName(cl.getUserId());
Log.printLine(getName() + ": Warning - Cloudlet #" + cl.getCloudletId() + " owned by " + name
+ " is already completed/finished.");
Log.printConcatLine(getName(), ": Warning - Cloudlet #", cl.getCloudletId(), " owned by ", name,
" is already completed/finished.");
Log.printLine("Therefore, it is not being executed again");
Log.printLine();
......
......@@ -80,7 +80,7 @@ public class Switch extends SimEntity {
@Override
public void startEntity() {
Log.printLine(getName() + " is starting...");
Log.printConcatLine(getName(), " is starting...");
schedule(getId(), 0, CloudSimTags.RESOURCE_CHARACTERISTICS_REQUEST);
}
......@@ -380,7 +380,7 @@ public class Switch extends SimEntity {
@Override
public void shutdownEntity() {
Log.printLine(getName() + " is shutting down...");
Log.printConcatLine(getName(), " is shutting down...");
}
}
......@@ -156,7 +156,7 @@ public abstract class PowerVmAllocationPolicyMigrationAbstract extends PowerVmAl
break;
}
Log.printLine("Under-utilized host: host #" + underUtilizedHost.getId() + "\n");
Log.printConcatLine("Under-utilized host: host #", underUtilizedHost.getId(), "\n");
excludedHostsForFindingUnderUtilizedHost.add(underUtilizedHost);
excludedHostsForFindingNewVmPlacement.add(underUtilizedHost);
......@@ -196,7 +196,7 @@ public abstract class PowerVmAllocationPolicyMigrationAbstract extends PowerVmAl
if (!Log.isDisabled()) {
Log.printLine("Over-utilized hosts:");
for (PowerHostUtilizationHistory host : overUtilizedHosts) {
Log.printLine("Host #" + host.getId());
Log.printConcatLine("Host #", host.getId());
}
Log.printLine();
}
......@@ -299,7 +299,7 @@ public abstract class PowerVmAllocationPolicyMigrationAbstract extends PowerVmAl
PowerHost allocatedHost = findHostForVm(vm, excludedHosts);
if (allocatedHost != null) {
allocatedHost.vmCreate(vm);
Log.printLine("VM #" + vm.getId() + " allocated to host #" + allocatedHost.getId());
Log.printConcatLine("VM #", vm.getId(), " allocated to host #", allocatedHost.getId());
Map<String, Object> migrate = new HashMap<String, Object>();
migrate.put("vm", vm);
......@@ -326,7 +326,7 @@ public abstract class PowerVmAllocationPolicyMigrationAbstract extends PowerVmAl
PowerHost allocatedHost = findHostForVm(vm, excludedHosts);
if (allocatedHost != null) {
allocatedHost.vmCreate(vm);
Log.printLine("VM #" + vm.getId() + " allocated to host #" + allocatedHost.getId());
Log.printConcatLine("VM #", vm.getId(), " allocated to host #", allocatedHost.getId());
Map<String, Object> migrate = new HashMap<String, Object>();
migrate.put("vm", vm);
......@@ -519,7 +519,7 @@ public abstract class PowerVmAllocationPolicyMigrationAbstract extends PowerVmAl
Vm vm = (Vm) map.get("vm");
PowerHost host = (PowerHost) map.get("host");
if (!host.vmCreate(vm)) {
Log.printLine("Couldn't restore VM #" + vm.getId() + " on host #" + host.getId());
Log.printConcatLine("Couldn't restore VM #", vm.getId(), " on host #", host.getId());
System.exit(0);
}
getVmTable().put(vm.getUid(), host);
......
......@@ -119,8 +119,8 @@ public class PowerVmAllocationPolicyMigrationInterQuartileRange extends
*/
protected void setSafetyParameter(double safetyParameter) {
if (safetyParameter < 0) {
Log.printLine("The safety parameter cannot be less than zero. The passed value is: "
+ safetyParameter);
Log.printConcatLine("The safety parameter cannot be less than zero. The passed value is: ",
safetyParameter);
System.exit(0);
}
this.safetyParameter = safetyParameter;
......
......@@ -119,8 +119,8 @@ public class PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation extends
*/
protected void setSafetyParameter(double safetyParameter) {
if (safetyParameter < 0) {
Log.printLine("The safety parameter cannot be less than zero. The passed value is: "
+ safetyParameter);
Log.printConcatLine("The safety parameter cannot be less than zero. The passed value is: ",
safetyParameter);
System.exit(0);
}
this.safetyParameter = safetyParameter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment