User: norbert 
  Date: 00/05/30 17:02:02

  Modified:    src/java/org/spyderMQ JMSServer.java JMSServerQueue.java
                        SpyConnection.java SpyQueueConnection.java
                        SpySession.java SpyTopicConnection.java
  Log:
  Send multiple messages with one RMI call
  
  Revision  Changes    Path
  1.34      +12 -7     spyderMQ/src/java/org/spyderMQ/JMSServer.java
  
  Index: JMSServer.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/JMSServer.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- JMSServer.java    2000/05/30 22:10:17     1.33
  +++ JMSServer.java    2000/05/31 00:02:00     1.34
  @@ -22,7 +22,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.33 $
  + *   @version $Revision: 1.34 $
    */
   public class JMSServer 
                implements Runnable 
  @@ -174,15 +174,20 @@
        }
        
        //A connection has send a new message
  -    public void newMessage(SpyMessage val,String id) throws JMSException 
  +    public void newMessage(SpyMessage val[],String id) throws JMSException 
        {
  -             Log.log("JMSserver: 
newMessage(dest="+val.jmsDestination+",val="+val.toString()+")");
  +             if (val.length!=1) Log.log("INCOMING: "+val.length+" messages from 
"+id);
                
  -             JMSServerQueue 
queue=(JMSServerQueue)messageQueue.get(val.jmsDestination);
  -             if (queue==null) throw new JMSException("This destination does not 
exist !");
  +             for(int i=0;i<val.length;i++) {
                
  -             //Add the message to the queue
  -             queue.addMessage(val);
  +                     Log.log("INCOMING: "+val[i]+" => "+val[i].jmsDestination);
  +             
  +                     JMSServerQueue 
queue=(JMSServerQueue)messageQueue.get(val[i].jmsDestination);
  +                     if (queue==null) throw new JMSException("This destination does 
not exist !");
  +             
  +                     //Add the message to the queue
  +                     queue.addMessage(val[i]);
  +             }
       }
        
        //A connection object wants to subscribe to a Destination
  
  
  
  1.29      +3 -3      spyderMQ/src/java/org/spyderMQ/JMSServerQueue.java
  
  Index: JMSServerQueue.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/JMSServerQueue.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- JMSServerQueue.java       2000/05/30 22:10:17     1.28
  +++ JMSServerQueue.java       2000/05/31 00:02:00     1.29
  @@ -18,7 +18,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.28 $
  + *   @version $Revision: 1.29 $
    */
   public class JMSServerQueue
   {
  @@ -246,13 +246,13 @@
                        //Let the thread do its work
                        if (msgs.length>1) {
                                //We can send multiple messages
  -                             Log.log("Send Msgs[1.."+msgs.length+"]");
  +                             Log.log("DISPATCH: "+msgs.length+" messages => 
"+destination);
                                sendMultipleMessages(msgs);
                        } else {
                                //Send each message
                                for(int i=0;i<msgs.length;i++) {
                                        SpyMessage message=(SpyMessage)msgs[i];
  -                                     Log.log("Send one 
msg("+message.toString()+")");
  +                                     Log.log("DISPATCH: "+message+" => 
"+destination);
                                        if (!message.isOutdated()) 
sendOneMessage(message);
                                }                       
                        }
  
  
  
  1.34      +2 -2      spyderMQ/src/java/org/spyderMQ/SpyConnection.java
  
  Index: SpyConnection.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpyConnection.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- SpyConnection.java        2000/05/30 23:17:00     1.33
  +++ SpyConnection.java        2000/05/31 00:02:01     1.34
  @@ -29,7 +29,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.33 $
  + *   @version $Revision: 1.34 $
    */
   public class SpyConnection 
                implements Connection, Serializable
  @@ -215,7 +215,7 @@
            
        //Send a message to the provider
        //[We should try to locally dispatch the message...]
  -     void sendToServer(SpyMessage mes) throws JMSException
  +     void sendToServer(SpyMessage mes[]) throws JMSException
        {
                if (closed) throw new IllegalStateException("The connection is 
closed");                
                if (distributedConnection==null) createReceiver();
  
  
  
  1.8       +3 -3      spyderMQ/src/java/org/spyderMQ/SpyQueueConnection.java
  
  Index: SpyQueueConnection.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpyQueueConnection.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SpyQueueConnection.java   2000/05/25 01:52:05     1.7
  +++ SpyQueueConnection.java   2000/05/31 00:02:01     1.8
  @@ -21,7 +21,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.7 $
  + *   @version $Revision: 1.8 $
    */
   public class SpyQueueConnection 
        extends SpyConnection 
  @@ -70,9 +70,9 @@
   
        // Package protected ---------------------------------------------
            
  -     void sendToServer(SpyMessage c) throws JMSException
  +     void sendToServer(SpyMessage[] c) throws JMSException
        {
  -             Log.log("Connection: 
sendToServer(Queue="+c.jmsDestination+",Msg="+c.toString()+")");
  +             Log.log("Connection: sendToServer("+c.length+" msgs)");
                super.sendToServer(c);
        }
   
  
  
  
  1.22      +15 -10    spyderMQ/src/java/org/spyderMQ/SpySession.java
  
  Index: SpySession.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpySession.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- SpySession.java   2000/05/30 22:10:18     1.21
  +++ SpySession.java   2000/05/31 00:02:01     1.22
  @@ -28,7 +28,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.21 $
  + *   @version $Revision: 1.22 $
    */
   public class SpySession 
        implements Runnable, Session
  @@ -176,32 +176,37 @@
                                
                                //look at outgoing queues
                                
  -                             SpyMessage outgoingJob=null;
  +                             SpyMessage outgoingJob[]=null;
                                
                                if (transacted) {               
                                        synchronized (outgoingCommitedQueue) {
                                                //The session is transacted, we take 
the outgoing msgs from outgoingCommitedQueue
                                                if (outgoingCommitedQueue.size()!=0) {
  -                                                     
outgoingJob=(SpyMessage)outgoingCommitedQueue.removeFirst();
  +                                                     SpyMessage array[]=new 
SpyMessage[outgoingCommitedQueue.size()];
  +                                                     
outgoingJob=(SpyMessage[])outgoingCommitedQueue.toArray(array);
  +                                                     outgoingCommitedQueue.clear();
                                                }                                      
                                         
                                        }
                                } else {
                                        synchronized (outgoingQueue) {
  -                                             //The session is not transacted, we 
take the outgoing msgs from outgoingQueue                                   
  +                                             //The session is not transacted, we 
take the outgoing msgs from outgoingQueue
                                                if (outgoingQueue.size()!=0) {
  -                                                     
outgoingJob=(SpyMessage)outgoingQueue.removeFirst();
  +                                                     SpyMessage array[]=new 
SpyMessage[outgoingQueue.size()];
  +                                                     
outgoingJob=(SpyMessage[])outgoingQueue.toArray(array);
  +                                                     outgoingQueue.clear();
                                                }
                                        }
                                }
                                
                                if (outgoingJob!=null) {
  -                                 //NL We should try (when it is possible) to send 
grouped messages to the server
  -                                 //NL Wait until we have a local optimisation
  +                                     
  +                                 //NL We should try (if possible) to send grouped 
messages to the server
  +                                 //NL Wait until we have 'local optimisation'
   
                                        try {
  -                                             if (!outgoingJob.isOutdated()) 
  -                                                     
connection.sendToServer(outgoingJob);
  -                                             doneJob=true;                          
                 
  +                                             //Check for outdated messages
  +                                             connection.sendToServer(outgoingJob);
  +                                             doneJob=true;
                                        } catch (JMSException e) {
                                                Log.log("Cannot send 
"+outgoingJob.toString()+" to the provider...");
                                                Log.error(e);
  
  
  
  1.17      +3 -3      spyderMQ/src/java/org/spyderMQ/SpyTopicConnection.java
  
  Index: SpyTopicConnection.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpyTopicConnection.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SpyTopicConnection.java   2000/05/16 03:31:00     1.16
  +++ SpyTopicConnection.java   2000/05/31 00:02:01     1.17
  @@ -21,7 +21,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.16 $
  + *   @version $Revision: 1.17 $
    */
   public class SpyTopicConnection 
        extends SpyConnection 
  @@ -82,9 +82,9 @@
   
        // Package protected ---------------------------------------------
            
  -     void sendToServer(SpyMessage c) throws JMSException
  +     void sendToServer(SpyMessage[] c) throws JMSException
        {
  -             Log.log("Connection: 
sendToServer(Topic="+c.jmsDestination+",Msg="+c.toString()+")");
  +             Log.log("Connection: sendToServer("+c.length+" msgs)");
                super.sendToServer(c);
        }
   
  
  
  

Reply via email to