/** * Clone the current file and make the new file as a <b>master</b> copy as well. * * @return a clone of the current file (as a master copy) or <tt>null</tt> if an error occurs */ public File makeMasterCopy() { File file = makeCopy(); if (file != null) { file.setMasterCopy(true); } return file; }
/** * Process data add. * * @param ev the ev * @param ack the ack */ protected void processDataAdd(SimEvent ev, boolean ack) { if (ev == null) { return; } Object[] pack = (Object[]) ev.getData(); if (pack == null) { return; } File file = (File) pack[0]; // get the file file.setMasterCopy(true); // set the file into a master copy int sentFrom = ((Integer) pack[1]).intValue(); // get sender ID /****** * // DEBUG Log.printLine(super.get_name() + ".addMasterFile(): " + file.getName() + * " from " + CloudSim.getEntityName(sentFrom)); *******/ Object[] data = new Object[3]; data[0] = file.getName(); int msg = addFile(file); // add the file if (ack) { data[1] = Integer.valueOf(-1); // no sender id data[2] = Integer.valueOf(msg); // the result of adding a master file sendNow(sentFrom, DataCloudTags.FILE_ADD_MASTER_RESULT, data); } }
file.setMasterCopy(true); // set the file into a master copy int sentFrom = ((Integer) pack[1]).intValue(); // get sender ID