/** * Gets the string representation of the current Cloudlet status code. * * @return the Cloudlet status code as a string or <tt>null</tt> if the * status code is unknown * @pre $none * @post $none */ public String getCloudletStatusString() { return Cloudlet.getStatusString(status); }
/** * Sets the execution status code of this Cloudlet. * * @param newStatus the status code of this Cloudlet * @throws Exception Invalid range of Cloudlet status * @pre newStatus >= 0 && newStatus <= 8 * @ * post $none * * @todo It has to throw an specific (unckecked) exception */ public void setCloudletStatus(final int newStatus) throws Exception { // if the new status is same as current one, then ignore the rest if (status == newStatus) { return; } // throws an exception if the new status is outside the range if (newStatus < Cloudlet.CREATED || newStatus > Cloudlet.FAILED_RESOURCE_UNAVAILABLE) { throw new Exception( "Cloudlet.setCloudletStatus() : Error - Invalid integer range for Cloudlet status."); } if (newStatus == Cloudlet.SUCCESS) { finishTime = CloudSim.clock(); } if (record) { write("Sets Cloudlet status from " + getCloudletStatusString() + " to " + Cloudlet.getStatusString(newStatus)); } status = newStatus; }