Good work...  Could you apply the same chanages to the UIL also??  Since 
they are almost identical, it would be nice if they were kept in synch.

Regards,
Hiram

>From: Brian Weaver <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: [JBoss-dev] CVS update: jbossmq/src/main/org/jboss/mq/il/oil 
>OILClientIL.java OILClientILService.java OILServerIL.java 
>OILServerILFactory.java OILServerILService.java
>Date: Thu, 10 Jan 2002 05:38:18 -0800
>
>   User: weave
>   Date: 02/01/10 05:38:17
>
>   Modified:    src/main/org/jboss/mq/il/oil OILClientIL.java
>                         OILClientILService.java OILServerIL.java
>                         OILServerILFactory.java OILServerILService.java
>   Log:
>   Changed the constants in the file to be all upper case words, without
>   having the 'm_' prepended to each constant.
>
>   Added some fixes to make the code behave better under linux, which has
>   problems with non-preemptable I/O. See the java bug database and search
>   on 'J2SE_PREEMPTCLOSE' for more information on the linux problem.
>
>   Synchronized the close() method of the OILClientIL.java file to prevent
>   concurrent access in the checkSocket() method which was not
>   synchronized.
>
>   Also, changed many of the 'protected' and 'package' level variables and
>   method to private. This allows JIT compilers to 'trivially' optimize
>   those sections of code since access is at most restrictive levels. This
>   did not cause any compile or runtime issues with the testsuite since
>   none of the members were referenced from other classes.
>
>   Finally, marked some of the classes final to allow JIT compilers 
>additional
>   hints for optimizations. Since the classes are not extended in JBoss
>   this does not appear to be a problem [I could be wrong, it wouldn't be
>   the first time! If so then I'm sure someone will joyfully revert my
>   changes and inform me of my erronous assumptions. Cheers!]
>
>   Revision  Changes    Path
>   1.5       +34 -18    
>jbossmq/src/main/org/jboss/mq/il/oil/OILClientIL.java
>
>   Index: OILClientIL.java
>   ===================================================================
>   RCS file: 
>/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILClientIL.java,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- OILClientIL.java        2001/11/26 06:33:12     1.4
>   +++ OILClientIL.java        2002/01/10 13:38:17     1.5
>   @@ -31,21 +31,26 @@
>     *
>     * @author    Norbert Lataille ([EMAIL PROTECTED])
>     * @author    Hiram Chirino ([EMAIL PROTECTED])
>   - * @version   $Revision: 1.4 $
>   + * @version   $Revision: 1.5 $
>     * @created   August 16, 2001
>     */
>   -public class OILClientIL implements ClientIL, java.io.Serializable
>   +public final class OILClientIL
>   +   implements ClientIL,
>   +      java.io.Serializable
>    {
>   -   static Logger log = Logger.getLogger(OILClientIL.class);
>   -   final static int m_close = 2;
>   -   final static int m_deleteTemporaryDestination = 1;
>   -   final static int m_receive = 3;
>   -   final static int m_pong = 4;
>   +   private final static int DELETE_TEMPORARY_DESTINATION   = 1;
>   +   private final static int CLOSE                          = 2;
>   +   private final static int RECEIVE                        = 3;
>   +   private final static int PONG                           = 4;
>
>   +   private final static int EXCEPTION_CODE                 = 1;
>   +
>   +   private final static Logger log = 
>Logger.getLogger(OILClientIL.class);
>   +
>       private InetAddress addr;
>   +   private int port;
>       private transient ObjectInputStream in;
>       private transient ObjectOutputStream out;
>   -   private int port;
>       private transient Socket socket;
>
>       OILClientIL(InetAddress addr, int port)
>   @@ -59,12 +64,23 @@
>        *
>        * @exception Exception  Description of Exception
>        */
>   -   public void close()
>   +   public synchronized void close()
>              throws Exception
>       {
>          checkSocket();
>   -      out.writeByte(m_close);
>   +      out.writeByte(CLOSE);
>          waitAnswer();
>   +      try
>   +      {
>   +         socket.close();
>   +         in.close();
>   +         out.close();
>   +      }
>   +      catch(Exception e)
>   +      {
>   +         if(log.isDebugEnabled())
>   +            log.debug("Error closing the socket connection", e);
>   +      }
>       }
>
>       /**
>   @@ -77,7 +93,7 @@
>              throws Exception
>       {
>          checkSocket();
>   -      out.writeByte(m_deleteTemporaryDestination);
>   +      out.writeByte(DELETE_TEMPORARY_DESTINATION);
>          out.writeObject(dest);
>          waitAnswer();
>       }
>   @@ -92,7 +108,7 @@
>              throws Exception
>       {
>          checkSocket();
>   -      out.writeByte(m_pong);
>   +      out.writeByte(PONG);
>          out.writeLong(serverTime);
>          waitAnswer();
>       }
>   @@ -112,7 +128,7 @@
>          checkSocket();
>          if( trace )
>             log.trace("Writing request");
>   -      out.writeByte(m_receive);
>   +      out.writeByte(RECEIVE);
>          out.writeInt(messages.length);
>          for (int i = 0; i < messages.length; ++i)
>          {
>   @@ -130,8 +146,8 @@
>        *
>        * @exception Exception  Description of Exception
>        */
>   -   protected void checkSocket()
>   -          throws Exception
>   +   private void checkSocket()
>   +          throws RemoteException
>       {
>          if (socket == null)
>          {
>   @@ -144,7 +160,7 @@
>        *
>        * @exception RemoteException  Description of Exception
>        */
>   -   protected void createConnection()
>   +   private void createConnection()
>              throws RemoteException
>       {
>          try
>   @@ -167,7 +183,7 @@
>        *
>        * @exception Exception  Description of Exception
>        */
>   -   protected void waitAnswer()
>   +   private void waitAnswer()
>              throws Exception
>       {
>          Exception throwException = null;
>   @@ -178,7 +194,7 @@
>             int val = in.readByte();
>             switch (val)
>             {
>   -            case 1:
>   +            case EXCEPTION_CODE:
>                   Exception e = (Exception)in.readObject();
>                   throwException = new RemoteException("", e);
>                   break;
>
>
>
>   1.6       +62 -47    
>jbossmq/src/main/org/jboss/mq/il/oil/OILClientILService.java
>
>   Index: OILClientILService.java
>   ===================================================================
>   RCS file: 
>/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILClientILService.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- OILClientILService.java 2001/12/14 00:22:43     1.5
>   +++ OILClientILService.java 2002/01/10 13:38:17     1.6
>   @@ -30,27 +30,35 @@
>     *
>     * @author    Norbert Lataille ([EMAIL PROTECTED])
>     * @author    Hiram Chirino ([EMAIL PROTECTED])
>   - * @version   $Revision: 1.5 $
>   + * @version   $Revision: 1.6 $
>     * @created   August 16, 2001
>     */
>   -public class OILClientILService implements Runnable, 
>org.jboss.mq.il.ClientILService
>   +public final class OILClientILService
>   +   implements java.lang.Runnable,
>   +      org.jboss.mq.il.ClientILService
>    {
>   +   private final static org.jboss.logging.Logger cat = 
>org.jboss.logging.Logger.getLogger(OILClientILService.class);
>
>   -   static org.jboss.logging.Logger cat = 
>org.jboss.logging.Logger.getLogger(OILClientILService.class);
>   -   // Attributes ----------------------------------------------------
>   -   final static int m_close = 2;
>   -   final static int m_deleteTemporaryDestination = 1;
>   -   final static int m_receive = 3;
>   -   final static int m_pong = 4;
>   +   private final static int DELETE_TEMPORARY_DESTINATION = 1;
>   +   private final static int CLOSE = 2;
>   +   private final static int RECEIVE = 3;
>   +   private final static int PONG = 4;
>   +
>       //the client IL
>   -   OILClientIL clientIL;
>   +   private OILClientIL clientIL;
>   +
>       //The thread that is doing the Socket reading work
>   -   Thread worker;
>   -   Socket socket = null;
>   +   private Thread worker;
>   +
>   +   // the connected client
>   +   private Socket socket = null;
>   +
>       //A link on my connection
>       private Connection connection;
>   +
>       //Should this service be running ?
>       private boolean running;
>   +
>       //The server socket we listen for a connection on
>       private ServerSocket serverSocket;
>
>   @@ -95,10 +103,12 @@
>          {
>             if( cat.isDebugEnabled() )
>                cat.debug("Waiting for the server to connect to me");
>   +
>             // We may close() before we get a connection so we need to
>             // periodicaly check to see if we were !running.
>   +         //
>             serverSocket.setSoTimeout(1000);
>   -         while (socket == null)
>   +         while (running && socket == null)
>             {
>                try
>                {
>   @@ -106,25 +116,31 @@
>                }
>                catch (java.io.InterruptedIOException e)
>                {
>   +               // do nothing, running flag will be checked
>   +               continue;
>                }
>                catch (IOException e)
>                {
>                   if (running)
>   -               {
>                      connection.asynchFailure("Error accepting connection 
>from server in OILClientILService.", e);
>   -               }
>   -               return;
>   +               return; // finally block will clean up!
>                }
>   -            if (!running)
>   -            {
>   -               return;
>   -            }
>             }
>   -         socket.setSoTimeout(0);
>   -         out = new ObjectOutputStream(new 
>BufferedOutputStream(socket.getOutputStream()));
>   -         out.flush();
>   -         in = new ObjectInputStream(new 
>BufferedInputStream(socket.getInputStream()));
>
>   +         if(running)
>   +         {
>   +            socket.setSoTimeout(0);
>   +            out = new ObjectOutputStream(new 
>BufferedOutputStream(socket.getOutputStream()));
>   +            out.flush();
>   +            in = new ObjectInputStream(new 
>BufferedInputStream(socket.getInputStream()));
>   +         }
>   +         else
>   +         {
>   +            // not running so exit
>   +            // let the finally block do the clean up
>   +            //
>   +            return;
>   +         }
>          }
>          catch (IOException e)
>          {
>   @@ -140,12 +156,15 @@
>             }
>             catch (IOException e)
>             {
>   +            if(cat.isDebugEnabled())
>   +               cat.debug("run: an error occured closing the server 
>socket", e);
>             }
>          }
>
>   +      // now process request from the client.
>   +      //
>          while (running)
>          {
>   -
>             try
>             {
>                if( cat.isTraceEnabled() )
>   @@ -166,7 +185,7 @@
>
>                switch (code)
>                {
>   -               case m_receive:
>   +               case RECEIVE:
>                      int numReceives = in.readInt();
>                      org.jboss.mq.ReceiveRequest[] messages = new 
>org.jboss.mq.ReceiveRequest[numReceives];
>                      for (int i = 0; i < numReceives; ++i)
>   @@ -176,15 +195,19 @@
>                      }
>                      connection.asynchDeliver(messages);
>                      break;
>   -               case m_deleteTemporaryDestination:
>   +
>   +               case DELETE_TEMPORARY_DESTINATION:
>                      
>connection.asynchDeleteTemporaryDestination((SpyDestination)in.readObject());
>                      break;
>   -               case m_close:
>   +
>   +               case CLOSE:
>                      connection.asynchClose();
>                      break;
>   -               case m_pong:
>   +
>   +               case PONG:
>                      connection.asynchPong(in.readLong());
>                      break;
>   +
>                   default:
>                      throw new RemoteException("Bad method code !");
>                }
>   @@ -199,14 +222,15 @@
>                catch (IOException e)
>                {
>                   connection.asynchFailure("Connection failure", e);
>   -               return;
>   +               break; // exit the loop
>                }
>   -
>             }
>             catch (Exception e)
>             {
>                if (!running)
>                {
>   +               // if not running then don't bother to log an error
>   +               //
>                   break;
>                }
>
>   @@ -221,30 +245,29 @@
>                catch (IOException e2)
>                {
>                   connection.asynchFailure("Connection failure", e2);
>   -               return;
>   +               break;
>                }
>   -
>             }
>   +      } // end while
>
>   -      }
>   -
>   +      // exited loop, so clean up the conection
>   +      //
>          try
>          {
>             cat.debug("Closing receiver connections.");
>             out.close();
>             in.close();
>   -         if (socket != null)
>   -         {
>   -            ;
>   -         }
>             socket.close();
>             socket = null;
>          }
>          catch (IOException e)
>          {
>             connection.asynchFailure("Connection failure", e);
>   -         return;
>          }
>   +
>   +      // ensure the flag is set correctly
>   +      //
>   +      running = false;
>       }
>
>       /**
>   @@ -271,13 +294,5 @@
>       {
>          running = false;
>          worker.interrupt();
>   -      if (serverSocket != null)
>   -      {
>   -         serverSocket.close();
>   -      }
>   -      if (socket != null)
>   -      {
>   -         socket.close();
>   -      }
>       }
>    }
>
>
>
>   1.5       +54 -51    
>jbossmq/src/main/org/jboss/mq/il/oil/OILServerIL.java
>
>   Index: OILServerIL.java
>   ===================================================================
>   RCS file: 
>/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerIL.java,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- OILServerIL.java        2001/09/27 04:09:36     1.4
>   +++ OILServerIL.java        2002/01/10 13:38:17     1.5
>   @@ -37,55 +37,58 @@
>     *
>     * @author    Hiram Chirino ([EMAIL PROTECTED])
>     * @author    Norbert Lataille ([EMAIL PROTECTED])
>   - * @version   $Revision: 1.4 $
>   + * @version   $Revision: 1.5 $
>     * @created   August 16, 2001
>     */
>   -public class OILServerIL implements java.io.Serializable, Cloneable, 
>org.jboss.mq.il.ServerIL
>   +public final class OILServerIL
>   +   implements java.io.Serializable,
>   +      java.lang.Cloneable,
>   +      org.jboss.mq.il.ServerIL
>    {
>   -   final static int m_acknowledge = 1;
>   -   final static int m_addMessage = 2;
>   -   final static int m_browse = 3;
>   -   final static int m_checkID = 4;
>   -   final static int m_connectionClosing = 5;
>   -   final static int m_createQueue = 6;
>   -   final static int m_createTopic = 7;
>   -   final static int m_deleteTemporaryDestination = 8;
>   -   final static int m_getID = 9;
>   -   final static int m_getTemporaryQueue = 10;
>   -   final static int m_getTemporaryTopic = 11;
>   -   final static int m_receive = 13;
>   -   final static int m_setEnabled = 14;
>   -   final static int m_setSpyDistributedConnection = 15;
>   -   final static int m_subscribe = 16;
>   -   final static int m_transact = 17;
>   -   final static int m_unsubscribe = 18;
>   -   final static int m_destroySubscription = 19;
>   -   final static int m_checkUser = 20;
>   -   final static int m_ping = 21;
>   +   private final static int ACKNOWLEDGE = 1;
>   +   private final static int ADDMESSAGE = 2;
>   +   private final static int BROWSE = 3;
>   +   private final static int CHECKID = 4;
>   +   private final static int CONNECTIONCLOSING = 5;
>   +   private final static int CREATEQUEUE = 6;
>   +   private final static int CREATETOPIC = 7;
>   +   private final static int DELETETEMPORARYDESTINATION = 8;
>   +   private final static int GETID = 9;
>   +   private final static int GETTEMPORARYQUEUE = 10;
>   +   private final static int GETTEMPORARYTOPIC = 11;
>   +   private final static int RECEIVE = 13;
>   +   private final static int SETENABLED = 14;
>   +   private final static int SETSPYDISTRIBUTEDCONNECTION = 15;
>   +   private final static int SUBSCRIBE = 16;
>   +   private final static int TRANSACT = 17;
>   +   private final static int UNSUBSCRIBE = 18;
>   +   private final static int DESTROYSUBSCRIPTION = 19;
>   +   private final static int CHECKUSER = 20;
>   +   private final static int PING = 21;
>
>       /**
>        * Description of the Field
>        */
>   -   protected InetAddress addr;
>   +   private InetAddress addr;
>       /**
>        * Description of the Field
>        */
>   -   protected transient ObjectInputStream in;
>   +   private transient ObjectInputStream in;
>
>       /**
>        * Description of the Field
>        */
>   -   protected transient ObjectOutputStream out;
>   +   private transient ObjectOutputStream out;
>       //Remote stuff
>       /**
>        * Description of the Field
>        */
>   -   protected int port;
>   +   private int port;
>
>       /**
>        * Description of the Field
>        */
>   -   protected transient Socket socket;
>   +   private transient Socket socket;
>
>       /**
>        * Constructor for the OILServerIL object
>   @@ -109,7 +112,7 @@
>              throws Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_setSpyDistributedConnection);
>   +      out.writeByte(SETSPYDISTRIBUTEDCONNECTION);
>          out.writeObject(dest);
>          waitAnswer();
>       }
>   @@ -126,7 +129,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_setEnabled);
>   +      out.writeByte(SETENABLED);
>          out.writeBoolean(enabled);
>          waitAnswer();
>       }
>   @@ -141,7 +144,7 @@
>              throws Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_getID);
>   +      out.writeByte(GETID);
>          return (String)waitAnswer();
>       }
>
>   @@ -157,7 +160,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_getTemporaryQueue);
>   +      out.writeByte(GETTEMPORARYQUEUE);
>          return (TemporaryQueue)waitAnswer();
>       }
>
>   @@ -173,7 +176,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_getTemporaryTopic);
>   +      out.writeByte(GETTEMPORARYTOPIC);
>          return (TemporaryTopic)waitAnswer();
>       }
>
>   @@ -189,7 +192,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_acknowledge);
>   +      out.writeByte(ACKNOWLEDGE);
>          item.writeExternal(out);
>          waitAnswer();
>       }
>   @@ -205,7 +208,7 @@
>              throws Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_addMessage);
>   +      out.writeByte(ADDMESSAGE);
>          SpyMessage.writeMessage(val, out);
>          waitAnswer();
>       }
>   @@ -224,7 +227,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_browse);
>   +      out.writeByte(BROWSE);
>          out.writeObject(dest);
>          out.writeObject(selector);
>          return (SpyMessage[])waitAnswer();
>   @@ -241,7 +244,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_checkID);
>   +      out.writeByte(CHECKID);
>          out.writeObject(ID);
>          waitAnswer();
>       }
>   @@ -259,7 +262,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_checkUser);
>   +      out.writeByte(CHECKUSER);
>          out.writeObject(userName);
>          out.writeObject(password);
>          return (String)waitAnswer();
>   @@ -301,7 +304,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_connectionClosing);
>   +      out.writeByte(CONNECTIONCLOSING);
>          waitAnswer();
>          destroyConnection();
>       }
>   @@ -319,7 +322,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_createQueue);
>   +      out.writeByte(CREATEQUEUE);
>          out.writeObject(dest);
>          return (Queue)waitAnswer();
>       }
>   @@ -337,7 +340,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_createTopic);
>   +      out.writeByte(CREATETOPIC);
>          out.writeObject(dest);
>          return (Topic)waitAnswer();
>       }
>   @@ -354,7 +357,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_deleteTemporaryDestination);
>   +      out.writeByte(DELETETEMPORARYDESTINATION);
>          out.writeObject(dest);
>          waitAnswer();
>       }
>   @@ -370,7 +373,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_destroySubscription);
>   +      out.writeByte(DESTROYSUBSCRIPTION);
>          out.writeObject(id);
>          waitAnswer();
>       }
>   @@ -386,7 +389,7 @@
>              throws Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_ping);
>   +      out.writeByte(PING);
>          out.writeLong(clientTime);
>          waitAnswer();
>       }
>   @@ -404,7 +407,7 @@
>              throws Exception, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_receive);
>   +      out.writeByte(RECEIVE);
>          out.writeInt(subscriberId);
>          out.writeLong(wait);
>          return (SpyMessage)waitAnswer();
>   @@ -422,7 +425,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_subscribe);
>   +      out.writeByte(SUBSCRIBE);
>          out.writeObject(s);
>          waitAnswer();
>       }
>   @@ -439,7 +442,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_transact);
>   +      out.writeByte(TRANSACT);
>          t.writeExternal(out);
>          waitAnswer();
>       }
>   @@ -456,7 +459,7 @@
>              throws JMSException, Exception
>       {
>          checkConnection();
>   -      out.writeByte(m_unsubscribe);
>   +      out.writeByte(UNSUBSCRIBE);
>          out.writeInt(subscriptionId);
>          waitAnswer();
>       }
>   @@ -466,7 +469,7 @@
>        *
>        * @exception Exception  Description of Exception
>        */
>   -   protected void checkConnection()
>   +   private void checkConnection()
>              throws Exception
>       {
>          if (socket == null)
>   @@ -480,7 +483,7 @@
>        *
>        * @exception Exception  Description of Exception
>        */
>   -   protected void createConnection()
>   +   private void createConnection()
>              throws Exception
>       {
>          socket = new Socket(addr, port);
>   @@ -494,7 +497,7 @@
>        *
>        * @exception Exception  Description of Exception
>        */
>   -   protected void destroyConnection()
>   +   private void destroyConnection()
>              throws Exception
>       {
>          out.close();
>   @@ -508,7 +511,7 @@
>        * @return               Description of the Returned Value
>        * @exception Exception  Description of Exception
>        */
>   -   protected Object waitAnswer()
>   +   private Object waitAnswer()
>              throws Exception
>       {
>          out.reset();
>
>
>
>   1.2       +11 -5     
>jbossmq/src/main/org/jboss/mq/il/oil/OILServerILFactory.java
>
>   Index: OILServerILFactory.java
>   ===================================================================
>   RCS file: 
>/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerILFactory.java,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- OILServerILFactory.java 2001/10/21 05:38:13     1.1
>   +++ OILServerILFactory.java 2002/01/10 13:38:17     1.2
>   @@ -16,9 +16,11 @@
>     * Factory class to produce OILServerIL objects.
>     *
>     * @author    <a href="mailto:[EMAIL PROTECTED]";>Hiram 
>Chirino</a>
>   - * @version   $Revision: 1.1 $
>   + * @version   $Revision: 1.2 $
>     */
>   -public class OILServerILFactory implements ServerILFactory {
>   +public final class OILServerILFactory
>   +   implements ServerILFactory
>   +{
>
>       final public static String SERVER_IL_FACTORY = 
>OILServerILFactory.class.getName();
>       final public static String CLIENT_IL_SERVICE = 
>OILClientILService.class.getName();
>   @@ -30,7 +32,9 @@
>       /**
>        * @see ServerILFactory#init(Properties)
>        */
>   -   public void init(Properties props) throws Exception {
>   +   public void init(Properties props)
>   +      throws Exception
>   +   {
>
>          String t = props.getProperty(OIL_ADDRESS_KEY);
>          if (t == null)
>   @@ -49,8 +53,10 @@
>       /**
>        * @see ServerILFactory#getServerIL()
>        */
>   -   public ServerIL getServerIL() throws Exception {
>   +   public ServerIL getServerIL()
>   +      throws Exception
>   +   {
>          return serverIL;
>       }
>
>   -}
>   \ No newline at end of file
>   +}
>
>
>
>   1.15      +62 -50    
>jbossmq/src/main/org/jboss/mq/il/oil/OILServerILService.java
>
>   Index: OILServerILService.java
>   ===================================================================
>   RCS file: 
>/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerILService.java,v
>   retrieving revision 1.14
>   retrieving revision 1.15
>   diff -u -r1.14 -r1.15
>   --- OILServerILService.java 2001/11/10 21:38:04     1.14
>   +++ OILServerILService.java 2002/01/10 13:38:17     1.15
>   @@ -48,48 +48,51 @@
>     * Implements the ServerILJMXService which is used to manage the JVM 
>IL.
>     *
>     * @author    Hiram Chirino ([EMAIL PROTECTED])
>   - * @version   $Revision: 1.14 $
>   + * @version   $Revision: 1.15 $
>     */
>   -public class OILServerILService extends 
>org.jboss.mq.il.ServerILJMXService implements Runnable, 
>OILServerILServiceMBean
>   +public final class OILServerILService
>   +   extends org.jboss.mq.il.ServerILJMXService
>   +   implements java.lang.Runnable,
>   +      OILServerILServiceMBean
>    {
>       //The server implementation
>       /**
>        * Description of the Field
>        */
>   -   protected static JMSServer server;
>   +   private static JMSServer server;
>
>   -   final static int m_acknowledge = 1;
>   -   final static int m_addMessage = 2;
>   -   final static int m_browse = 3;
>   -   final static int m_checkID = 4;
>   -   final static int m_connectionClosing = 5;
>   -   final static int m_createQueue = 6;
>   -   final static int m_createTopic = 7;
>   -   final static int m_deleteTemporaryDestination = 8;
>   -   final static int m_getID = 9;
>   -   final static int m_getTemporaryQueue = 10;
>   -   final static int m_getTemporaryTopic = 11;
>   -   final static int m_receive = 13;
>   -   final static int m_setEnabled = 14;
>   -   final static int m_setSpyDistributedConnection = 15;
>   -   final static int m_subscribe = 16;
>   -   final static int m_transact = 17;
>   -   final static int m_unsubscribe = 18;
>   -   final static int m_destroySubscription = 19;
>   -   final static int m_checkUser = 20;
>   -   final static int m_ping = 21;
>   +   private final static int ACKNOWLEDGE = 1;
>   +   private final static int ADDMESSAGE = 2;
>   +   private final static int BROWSE = 3;
>   +   private final static int CHECKID = 4;
>   +   private final static int CONNECTIONCLOSING = 5;
>   +   private final static int CREATEQUEUE = 6;
>   +   private final static int CREATETOPIC = 7;
>   +   private final static int DELETETEMPORARYDESTINATION = 8;
>   +   private final static int GETID = 9;
>   +   private final static int GETTEMPORARYQUEUE = 10;
>   +   private final static int GETTEMPORARYTOPIC = 11;
>   +   private final static int RECEIVE = 13;
>   +   private final static int SETENABLED = 14;
>   +   private final static int SETSPYDISTRIBUTEDCONNECTION = 15;
>   +   private final static int SUBSCRIBE = 16;
>   +   private final static int TRANSACT = 17;
>   +   private final static int UNSUBSCRIBE = 18;
>   +   private final static int DESTROYSUBSCRIPTION = 19;
>   +   private final static int CHECKUSER = 20;
>   +   private final static int PING = 21;
>
>   -   final static int SO_TIMEOUT = 5000;
>   +   private final static int SO_TIMEOUT = 5000;
>       /**
>        * Description of the Field
>        */
>   -   protected ServerSocket serverSocket;
>   -   OILServerIL serverIL;
>   +   private ServerSocket serverSocket;
>   +   private OILServerIL serverIL;
>
>   -   boolean running;
>   -   int serverBindPort = 0;
>   -   InetAddress bindAddress = null;
>   -   Thread worker;
>   +   private volatile boolean running;
>   +   private int serverBindPort = 0;
>   +   private InetAddress bindAddress = null;
>   +   private Thread worker;
>
>       /**
>        * Used to construct the GenericConnectionFactory 
>(bindJNDIReferences()
>   @@ -150,11 +153,20 @@
>                }
>                catch (java.io.InterruptedIOException e)
>                {
>   +               // do nothing!
>                }
>             }
>
>             if (!running)
>             {
>   +            try
>   +            {
>   +               serverSocket.close();
>   +            }
>   +            catch(Exception e)
>   +            {
>   +               log.debug("error closing server socket", e);
>   +            }
>                return;
>             }
>
>   @@ -209,70 +221,70 @@
>
>                switch (code)
>                {
>   -               case m_setSpyDistributedConnection:
>   +               case SETSPYDISTRIBUTEDCONNECTION:
>                      connectionToken = (ConnectionToken)in.readObject();
>                      log.debug("The OILClientIL Connection is set up");
>                      break;
>   -               case m_acknowledge:
>   +               case ACKNOWLEDGE:
>                      AcknowledgementRequest ack = new 
>AcknowledgementRequest();
>                      ack.readExternal(in);
>                      server.acknowledge(connectionToken, ack);
>                      break;
>   -               case m_addMessage:
>   +               case ADDMESSAGE:
>                      server.addMessage(connectionToken, 
>SpyMessage.readMessage(in));
>                      break;
>   -               case m_browse:
>   +               case BROWSE:
>                      result = server.browse(connectionToken, 
>(Destination)in.readObject(), (String)in.readObject());
>                      break;
>   -               case m_checkID:
>   +               case CHECKID:
>                      server.checkID((String)in.readObject());
>                      break;
>   -               case m_connectionClosing:
>   +               case CONNECTIONCLOSING:
>                      server.connectionClosing(connectionToken);
>                      closed = true;
>                      break;
>   -               case m_createQueue:
>   +               case CREATEQUEUE:
>                      result = (Queue)server.createQueue(connectionToken, 
>(String)in.readObject());
>                      break;
>   -               case m_createTopic:
>   +               case CREATETOPIC:
>                      result = (Topic)server.createTopic(connectionToken, 
>(String)in.readObject());
>                      break;
>   -               case m_deleteTemporaryDestination:
>   +               case DELETETEMPORARYDESTINATION:
>                      server.deleteTemporaryDestination(connectionToken, 
>(SpyDestination)in.readObject());
>                      break;
>   -               case m_getID:
>   +               case GETID:
>                      result = server.getID();
>                      break;
>   -               case m_getTemporaryQueue:
>   +               case GETTEMPORARYQUEUE:
>                      result = 
>(TemporaryQueue)server.getTemporaryQueue(connectionToken);
>                      break;
>   -               case m_getTemporaryTopic:
>   +               case GETTEMPORARYTOPIC:
>                      result = 
>(TemporaryTopic)server.getTemporaryTopic(connectionToken);
>                      break;
>   -               case m_receive:
>   +               case RECEIVE:
>                      result = server.receive(connectionToken, 
>in.readInt(), in.readLong());
>                      break;
>   -               case m_setEnabled:
>   +               case SETENABLED:
>                      server.setEnabled(connectionToken, in.readBoolean());
>                      break;
>   -               case m_subscribe:
>   +               case SUBSCRIBE:
>                      server.subscribe(connectionToken, 
>(Subscription)in.readObject());
>                      break;
>   -               case m_transact:
>   +               case TRANSACT:
>                      TransactionRequest trans = new TransactionRequest();
>                      trans.readExternal(in);
>                      server.transact(connectionToken, trans);
>                      break;
>   -               case m_unsubscribe:
>   +               case UNSUBSCRIBE:
>                      server.unsubscribe(connectionToken, in.readInt());
>                      break;
>   -               case m_destroySubscription:
>   +               case DESTROYSUBSCRIPTION:
>                      
>server.destroySubscription((DurableSubcriptionID)in.readObject());
>                      break;
>   -               case m_checkUser:
>   +               case CHECKUSER:
>                      result = server.checkUser((String)in.readObject(), 
>(String)in.readObject());
>                      break;
>   -               case m_ping:
>   +               case PING:
>                      server.ping(connectionToken, in.readLong());
>                      break;
>                   default:
>
>
>
>
>_______________________________________________
>Jboss-development mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/jboss-development




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to