From: <aca...@us...> - 2008-07-29 14:27:26
|
Revision: 190 http://gridsim.svn.sourceforge.net/gridsim/?rev=190&view=rev Author: acaminero Date: 2008-07-29 14:27:35 +0000 (Tue, 29 Jul 2008) Log Message: ----------- to allow future extensions (drop other things than files and gridlets) Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbOutput.java Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbOutput.java 2008-07-29 14:25:19 UTC (rev 189) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbOutput.java 2008-07-29 14:27:35 UTC (rev 190) @@ -323,19 +323,36 @@ int pkt_dropped_id = userPkt.getPkt(); int user_id = userPkt.getUser(); - Fnb_failed_gridlet_file fglf = lookForGridlet(pkt_dropped_id); - int glID = fglf.getEntityID(); + FnbMessage msgDrop = lookForEntity(pkt_dropped_id); - if (glID != 9999) + int glID; + if (msgDrop != null) { - // Tell the user that the gridlet is failed because of the dropping of a packet - super.sim_schedule(user_id, GridSimTags.SCHEDULE_NOW, - GridSimTags.FNB_GRIDLET_FAILED_BECAUSE_PACKET_DROPPED, fglf); + glID = msgDrop.getEntityID(); + + if (glID != 9999) + { + // Check if it is a file or a gridlet + if (msgDrop instanceof FnbMessageDropFile) + { + // Tell the user that the file is failed because of the dropping of a packet + super.sim_schedule(user_id, GridSimTags.SCHEDULE_NOW, + GridSimTags. + FNB_FILE_FAILED_BECAUSE_PACKET_DROPPED, + msgDrop); + } + else if (msgDrop instanceof FnbMessageDropGridlet) + { + // Tell the user that the gridlet is failed because of the dropping of a packet + super.sim_schedule(user_id, GridSimTags.SCHEDULE_NOW, + GridSimTags. + FNB_GRIDLET_FAILED_BECAUSE_PACKET_DROPPED, + msgDrop); + } + } + ev = null; // new, to call the garbage collector } - ev = null; // new, to call the garbage collector - - } @@ -996,9 +1013,9 @@ * @param pkt the ID of the packet of interest * @return a Fnb_failed_gridlet_file object, containing the entity (gridlet/file) ID, and if the entity is a file * */ - Fnb_failed_gridlet_file lookForGridlet(int pktID) + FnbMessage lookForEntity(int pktID) { - Fnb_failed_gridlet_file fglfile = new Fnb_failed_gridlet_file(9999, false); + FnbMessage msgDrop = null; // = new FnbMessage(9999, false); for (int i = 0; i < packetsGridletsList_.size(); i++) { firstLastPacketsGridlet flPktGl = (firstLastPacketsGridlet) @@ -1006,20 +1023,20 @@ if ((flPktGl.getFirst() <= pktID) && (flPktGl.getLast() > pktID)) { - fglfile.setEntityID(flPktGl.getGridletID()); - fglfile.setIsFile(flPktGl.getIsFile()); + if (flPktGl.getIsFile()) + msgDrop = new FnbMessageDropFile(flPktGl.getGridletID() , getFilename(flPktGl.getGridletID())); + else + msgDrop = new FnbMessageDropGridlet(flPktGl.getGridletID()); - fglfile.setFilename(getFilename(fglfile.getEntityID())); - - /*System.out.println(super.get_name() + ": lookForGridlet: entiyID: " + + System.out.println(super.get_name() + ": lookForEntity: entiyID: " + flPktGl.getGridletID() + ". isFile " + flPktGl.getIsFile() + - ". filename " + getFilename(fglfile.getEntityID()));*/ + ". filename " + getFilename(msgDrop.getEntityID())); - return fglfile; + return msgDrop; } } - return fglfile;// if there is no gridlet, return this + return msgDrop;// if there is no entity, return this } } // end class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |