chamikara    2005/02/17 22:38:46

  Modified:    sandesha/src/org/apache/sandesha/client
                        ClientStorageManager.java
               sandesha/src/org/apache/sandesha/storage/queue
                        ResponseSequenceHash.java SandeshaQueue.java
                        SequenceHash.java
  Log:
   Fololowing methods were added
  
   public void addSendMsgNo(String seqId,long msgNo);
  
  public boolean isSentMsg(String seqId,long msgNo);
  
  public boolean hasLastMsgReceived(String seqId);
  
  public long getLastMsgNo(String seqId);
  
  Revision  Changes    Path
  1.17      +31 -0     
ws-fx/sandesha/src/org/apache/sandesha/client/ClientStorageManager.java
  
  Index: ClientStorageManager.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/sandesha/src/org/apache/sandesha/client/ClientStorageManager.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ClientStorageManager.java 16 Feb 2005 04:21:21 -0000      1.16
  +++ ClientStorageManager.java 18 Feb 2005 06:38:46 -0000      1.17
  @@ -392,4 +392,35 @@
       public void insertFault(RMMessageContext rmMsgCtx) {
           //To change body of implemented methods use File | Settings | File 
Templates.
       }
  +    
  +    
  +     /* (non-Javadoc)
  +      * @see 
org.apache.sandesha.IStorageManager#addSentMsgNo(java.lang.String, long)
  +      */
  +
  +     /* (non-Javadoc)
  +      * @see 
org.apache.sandesha.IStorageManager#addSendMsgNo(java.lang.String, long)
  +      */
  +     public void addSendMsgNo(String seqId, long msgNo) {
  +             accessor.addSendMsgNo(seqId,msgNo);
  +
  +     }
  +     /* (non-Javadoc)
  +      * @see 
org.apache.sandesha.IStorageManager#getLastMsgNo(java.lang.String)
  +      */
  +     public long getLastMsgNo(String seqId) {
  +             return accessor.getLastMsgNo(seqId);
  +     }
  +     /* (non-Javadoc)
  +      * @see 
org.apache.sandesha.IStorageManager#hasLastMsgReceived(java.lang.String)
  +      */
  +     public boolean hasLastMsgReceived(String seqId) {
  +             return accessor.hasLastMsgReceived(seqId);
  +     }
  +     /* (non-Javadoc)
  +      * @see org.apache.sandesha.IStorageManager#isSentMsg(java.lang.String, 
long)
  +      */
  +     public boolean isSentMsg(String seqId, long msgNo) {
  +             return accessor.isSentMsg(seqId,msgNo);
  +     }
   }
  \ No newline at end of file
  
  
  
  1.2       +34 -0     
ws-fx/sandesha/src/org/apache/sandesha/storage/queue/ResponseSequenceHash.java
  
  Index: ResponseSequenceHash.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/sandesha/src/org/apache/sandesha/storage/queue/ResponseSequenceHash.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResponseSequenceHash.java 16 Feb 2005 08:04:32 -0000      1.1
  +++ ResponseSequenceHash.java 18 Feb 2005 06:38:46 -0000      1.2
  @@ -53,6 +53,10 @@
       private HashMap hash;
   
       private Vector markedAsDelete;
  +    
  +    private Vector sendMsgNoList;
  +    
  +    private long lastMsgNo = -1;
   
       private long nextAutoNumber; // key for storing messages.
       //--> USING AUTONUMBER FOR MESSAGENUMBERS
  @@ -66,6 +70,8 @@
           markedAsDelete = new Vector();
           nextAutoNumber = 1; //This is the key for storing messages.
           outSeqApproved = false;
  +        
  +        sendMsgNoList = new Vector ();
       }
   
       /*
  @@ -382,5 +388,33 @@
   
           return -1;
       }
  +    
  +    public void addMsgToSendList(long msgNo){
  +     sendMsgNoList.add( new Long(msgNo));
  +    }
  +    
  +    public boolean isMsgInSentList(long msgNo){
  +     return sendMsgNoList.contains(new Long(msgNo));
  +    }
  +    
  +    public boolean hasLastMsgReceived(){
  +       if(lastMsgNo >0)
  +                return true;
  +
  +       return false;
  +    }
  +
  +    public long getLastMsgNumber(){
  +     if(lastMsgNo>0)
  +             return lastMsgNo;
  +     
  +     return -1;
  +    }
  +    
  +    public void setLastMsg(long lastMsg){
  +     lastMsgNo = lastMsg;
  +    }
  +    
  +
   
   }
  \ No newline at end of file
  
  
  
  1.2       +56 -0     
ws-fx/sandesha/src/org/apache/sandesha/storage/queue/SandeshaQueue.java
  
  Index: SandeshaQueue.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/sandesha/src/org/apache/sandesha/storage/queue/SandeshaQueue.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SandeshaQueue.java        16 Feb 2005 08:04:32 -0000      1.1
  +++ SandeshaQueue.java        18 Feb 2005 06:38:46 -0000      1.2
  @@ -113,6 +113,11 @@
                   if (resSeqHash == null)
                       throw new QueueException("Inconsistent queue");
                   resSeqHash.putNewMessage(msgCon);
  +                
  +                //if last message
  +                if(msgCon.isLastMessage())
  +                     resSeqHash.setLastMsg(msgCon.getMsgNumber());
  +                     
               }
           }
   
  @@ -702,6 +707,7 @@
           Iterator it = outgoingMap.keySet().iterator();
   
           String key = null;
  +        
           while (it.hasNext()) {
               key = (String) it.next();
               Object obj = outgoingMap.get(key);
  @@ -863,5 +869,55 @@
   
           return terminateMsg;
       }
  +    
  +    public void addSendMsgNo(String seqId,long msgNo){
  +     ResponseSequenceHash rsh = (ResponseSequenceHash) 
outgoingMap.get(seqId);
  +     
  +        if (rsh == null) {
  +            System.out.println("ERROR: SEQ IS NULL");
  +        }
  +        
  +     synchronized(rsh){
  +             rsh.addMsgToSendList(msgNo);
  +     }
  +    }
  +    
  +    public boolean isSentMsg(String seqId,long msgNo){
  +     ResponseSequenceHash rsh = (ResponseSequenceHash) 
outgoingMap.get(seqId);
  +     
  +        if (rsh == null) {
  +            System.out.println("ERROR: SEQ IS NULL");
  +        }
  +        
  +     synchronized(rsh){
  +             return rsh.isMsgInSentList(msgNo);
  +     }       
  +    }
  +    
  +    public boolean hasLastMsgReceived(String seqId){
  +     ResponseSequenceHash rsh = (ResponseSequenceHash) 
outgoingMap.get(seqId);
  +     
  +        if (rsh == null) {
  +            System.out.println("ERROR: SEQ IS NULL");
  +        }
  +        
  +        synchronized(rsh){
  +             return rsh.hasLastMsgReceived();
  +        }        
  +    }
  +
  +    public long getLastMsgNo(String seqId){
  +     ResponseSequenceHash rsh = (ResponseSequenceHash) 
outgoingMap.get(seqId);
  +     
  +        if (rsh == null) {
  +            System.out.println("ERROR: SEQ IS NULL");
  +        }
  +        
  +        synchronized(rsh){
  +             return rsh.getLastMsgNumber();
  +        } 
  +    }
  +    
  +    
   }
   
  
  
  
  1.2       +4 -0      
ws-fx/sandesha/src/org/apache/sandesha/storage/queue/SequenceHash.java
  
  Index: SequenceHash.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/sandesha/src/org/apache/sandesha/storage/queue/SequenceHash.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SequenceHash.java 16 Feb 2005 08:04:32 -0000      1.1
  +++ SequenceHash.java 18 Feb 2005 06:38:46 -0000      1.2
  @@ -45,6 +45,7 @@
   
       private boolean beingProcessedLock = false; //When true messages are
   
  +
       // currently being processed.
   
       public SequenceHash(String sequenceId) {
  @@ -236,4 +237,7 @@
           }
           return false;
       }
  +    
  +
  +    
   }
  \ No newline at end of file
  
  
  

Reply via email to