You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ja...@apache.org on 2004/10/20 12:31:45 UTC

cvs commit: ws-fx/sandesha/src/org/apache/sandesha/server/queue ResponseSequenceHash.java

jaliya      2004/10/20 03:31:45

  Modified:    sandesha/src/org/apache/sandesha/server/queue
                        ResponseSequenceHash.java
  Log:
  Fixed the bugs and formatted the code
  
  Revision  Changes    Path
  1.4       +18 -6     ws-fx/sandesha/src/org/apache/sandesha/server/queue/ResponseSequenceHash.java
  
  Index: ResponseSequenceHash.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/sandesha/src/org/apache/sandesha/server/queue/ResponseSequenceHash.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ResponseSequenceHash.java	20 Sep 2004 12:17:07 -0000	1.3
  +++ ResponseSequenceHash.java	20 Oct 2004 10:31:45 -0000	1.4
  @@ -145,8 +145,8 @@
           //Long nextKey = new Long (lastProcessed+1);
           //RMMessageContext msg = (RMMessageContext) hash.get(nextKey);
   
  -        RMMessageContext msg = null;
  -
  +        //RMMessageContext msg = null;
  +        RMMessageContext minMsg = null;
           Iterator keys = hash.keySet().iterator();
   
           whileLoop: while (keys.hasNext()) {
  @@ -159,13 +159,25 @@
               //System.out.println("current time: "+currentTime);
               // System.out.println("difference: "+(currentTime-lastSentTime));
               if (currentTime >= lastSentTime + Constants.RETRANSMISSION_INTERVAL) {
  -                msg = tempMsg;
  -                msg.setLastSentTime(currentTime);
  -                break whileLoop;
  +                if (minMsg == null)
  +                    minMsg = tempMsg;
  +                else {
  +                    long msgNo1, msgNo2;
  +                    msgNo1 = tempMsg.getMsgNumber();
  +                    msgNo2 = minMsg.getMsgNumber();
  +                    if (msgNo1 < msgNo2)
  +                        minMsg = tempMsg;
  +                }
               }
           }
   
  -        return msg;
  +        Date d = new Date();
  +        long time = d.getTime();
  +        if (minMsg != null) {
  +            minMsg.setLastSentTime(time);
  +        }
  +
  +        return minMsg;
       }
   
       /**