From: <bro...@us...> - 2008-03-12 06:52:45
|
Revision: 148 http://gridsim.svn.sourceforge.net/gridsim/?rev=148&view=rev Author: brobergj Date: 2008-03-11 23:52:49 -0700 (Tue, 11 Mar 2008) Log Message: ----------- Bug fixes Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java 2008-03-11 03:01:34 UTC (rev 147) +++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java 2008-03-12 06:52:49 UTC (rev 148) @@ -166,7 +166,7 @@ * @pre $none * @post $none */ - public synchronized void body() + public void body() { // Process events Object obj = null; @@ -186,32 +186,25 @@ } else if(ev.get_tag() == GridSimTags.FLOW_HOLD) { System.out.println(super.get_name() + ".body(): checkForecast() + at time = " + GridSim.clock()); checkForecast(ev); - break; // Update flow duration forecast } else if (ev.get_tag() == GridSimTags.FLOW_UPDATE) { System.out.println(super.get_name() + ".body(): updateForecast() + at time = " + GridSim.clock()); updateForecast(ev); - break; - //} else if (ev.get_tag() == GridSimTags.FLOW_ACK) { - // System.out.println(super.get_name() + ".body(): submitAckToLink() + at time = " + GridSim.clock()); - //submitAckToLink(ev); - // break; - } - // if this entity is not connected in a network topology - if (obj != null && obj instanceof IO_data) { + } else if (obj != null && obj instanceof IO_data) { System.out.println(super.get_name() + ".body(): getDataFromEvent() + at time = " + GridSim.clock()); getDataFromEvent(ev); - } - // if this entity belongs to a network topology - else if (obj != null && link_ != null) { + } else if (obj != null && link_ != null) { System.out.println(super.get_name() + ".body(): getDataFromLink() + at time = " + GridSim.clock()); getDataFromLink(ev); } ev = null; // reset to null for gc to collect } + + System.out.println(super.get_name() + ":%%%% Exiting body() at time " + + GridSim.clock() ); } /** @@ -221,7 +214,7 @@ * @pre ev != null * @post $none */ - private synchronized void checkForecast(Sim_event ev) { + private void checkForecast(Sim_event ev) { int pktID = (Integer) ev.get_data(); // ID of flow to be checked FlowPacket fp = null; // Reference to flow packet that needs forecast update FlowPacket fpAck = null; @@ -272,7 +265,7 @@ * @pre ev != null * @post $none */ - private synchronized void updateForecast(Sim_event ev) { + private void updateForecast(Sim_event ev) { int pktID = (Integer) ev.get_data(); // ID of flow to be updated FlowPacket fp = null; // Reference to flow packet that needs forecast update double duration = 0.0; // New forecast duration from current Gridsim.clock() @@ -310,8 +303,9 @@ + cancelledFlow); } - + System.out.println(super.get_name() + " setting updated forecast for packet #" + fp.getID()); super.sim_schedule(super.get_id(), duration, GridSimTags.FLOW_HOLD , new Integer(fp.getID())); + } } @@ -391,15 +385,6 @@ ev.get_tag(), io.getData() ); } - private synchronized void submitAckToLink(Sim_event ev) - { - - FlowPacket fp = (FlowPacket)ev.get_data(); - System.out.println("Sending flow packet ack to link at time = " + GridSim.clock() + " id is " - + ((FlowPacket) ev.get_data()).getID()); - super.sim_schedule(this.link_.get_id(), GridSimTags.SCHEDULE_NOW, GridSimTags.PKT_FORWARD, fp); - } - /** * Process incoming events from senders that are using the network * extension @@ -448,7 +433,8 @@ // if flow terminates at next entity, add to active flows // & hold for appropriate duration - if (pkt.getTag() == GridSimTags.FLOW_SUBMIT) { + if (pkt.getTag() == GridSimTags.FLOW_SUBMIT || pkt.getTag() == GridSimTags.GRIDLET_SUBMIT || + pkt.getTag() == GridSimTags.GRIDLET_SUBMIT_ACK || pkt.getTag() == GridSimTags.GRIDLET_RETURN) { np.setStartTime(GridSim.clock()); np.setUpdateTime(GridSim.clock()); duration = np.getSize()*SIZE / np.getBandwidth_(); @@ -457,15 +443,20 @@ System.out.println(super.get_name() + ".getDataFromLink() forecast flow end at " + (GridSim.clock() + duration)); - // if flow is just an ACK of a finished flow do not hold + // if flow is just an ACK of a finished flow do not hold, no action required } else if (pkt.getTag() == GridSimTags.FLOW_RETURN){ - duration = 0.0; + //duration = 0.0; + return; // send the data into entity input/output port - super.sim_schedule(inPort_, duration, tag, - io.getData() ); + // super.sim_schedule(inPort_, duration, tag, + // io.getData() ); } + + // send the data into entity input port + super.sim_schedule(inPort_, GridSimTags.SCHEDULE_NOW, tag, + io.getData() ); + - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |