User: chirino 
  Date: 01/08/31 20:00:59

  Modified:    src/main/org/jboss/mq/il/oil OILServerILService.java
  Log:
  Fixing compile problems due to migration of classes from jboss.util to jboss.system
  
  Revision  Changes    Path
  1.4       +141 -97   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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OILServerILService.java   2001/08/30 02:35:54     1.3
  +++ OILServerILService.java   2001/09/01 03:00:59     1.4
  @@ -1,5 +1,5 @@
   /*
  - * JBossMQ, the OpenSource JMS implementation
  + * JBoss, the OpenSource J2EE webOS
    *
    * Distributable under LGPL license.
    * See terms of license at gnu.org.
  @@ -8,14 +8,11 @@
   import java.io.BufferedInputStream;
   import java.io.BufferedOutputStream;
   import java.io.EOFException;
  -
   import java.io.IOException;
  -
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
   import java.net.InetAddress;
   import java.net.ServerSocket;
  -
   import java.net.Socket;
   import java.rmi.RemoteException;
   
  @@ -24,16 +21,14 @@
   import javax.jms.JMSException;
   import javax.jms.Queue;
   import javax.jms.TemporaryQueue;
  -
   import javax.jms.TemporaryTopic;
  -
   import javax.jms.Topic;
   import javax.management.*;
  +
   import javax.naming.InitialContext;
   import org.jboss.mq.AcknowledgementRequest;
   import org.jboss.mq.ConnectionToken;
   import org.jboss.mq.DurableSubcriptionID;
  -
   import org.jboss.mq.GenericConnectionFactory;
   import org.jboss.mq.SpyDestination;
   import org.jboss.mq.SpyMessage;
  @@ -50,16 +45,10 @@
    *  Implements the ServerILJMXService which is used to manage the JVM IL.
    *
    * @author     Hiram Chirino ([EMAIL PROTECTED])
  - * @created    August 16, 2001
  - * @version    $Revision: 1.3 $
  + * @version    $Revision: 1.4 $
    */
  -public class OILServerILService extends org.jboss.mq.il.ServerILJMXService 
implements Runnable, OILServerILServiceMBean {
  -   protected ServerSocket serverSocket;
  -   OILServerIL      serverIL;
  -
  -   boolean          running;
  -   int              serverBindPort = 0;
  -   Thread           worker;
  +public class OILServerILService extends org.jboss.mq.il.ServerILJMXService 
implements Runnable, OILServerILServiceMBean
  +{
      //The server implementation
      protected static JMSServer server;
   
  @@ -83,13 +72,20 @@
      final static int m_destroySubscription = 19;
      final static int m_checkUser = 20;
      final static int SO_TIMEOUT = 5000;
  +   protected ServerSocket serverSocket;
  +   OILServerIL serverIL;
  +
  +   boolean running;
  +   int serverBindPort = 0;
  +   Thread worker;
   
      /**
       *  Gives this JMX service a name.
       *
       * @return    The Name value
       */
  -   public String getName() {
  +   public String getName()
  +   {
         return "JBossMQ-OILServerIL";
      }
   
  @@ -100,7 +96,8 @@
       * @return     The ServerIL value
       * @returns    ServerIL the instance of this IL
       */
  -   public ServerIL getServerIL() {
  +   public ServerIL getServerIL()
  +   {
         return serverIL;
      }
   
  @@ -111,9 +108,10 @@
       *
       * @return    The ClientConnectionProperties value
       */
  -   public java.util.Properties getClientConnectionProperties() {
  +   public java.util.Properties getClientConnectionProperties()
  +   {
         Properties rc = new Properties();
  -      rc.setProperty( GenericConnectionFactory.CLIENT_IL_SERVICE_KEY, 
"org.jboss.mq.il.oil.OILClientILService" );
  +      rc.setProperty(GenericConnectionFactory.CLIENT_IL_SERVICE_KEY, 
"org.jboss.mq.il.oil.OILClientILService");
         return rc;
      }
   
  @@ -122,20 +120,20 @@
       *
       * @exception  Exception  Description of Exception
       */
  -   public void startService()
  -      throws Exception {
  +   public void startService() throws Exception
  +   {
   
         running = true;
         this.server = lookupJMSServer();
   
  -      serverSocket = new ServerSocket( serverBindPort );
  -      serverSocket.setSoTimeout( SO_TIMEOUT );
  +      serverSocket = new ServerSocket(serverBindPort);
  +      serverSocket.setSoTimeout(SO_TIMEOUT);
   
  -      category.info( "JBossMQ OIL service available at : " + 
InetAddress.getLocalHost().getHostAddress() + ":" + serverSocket.getLocalPort() );
  -      worker = new Thread( server.threadGroup, this, "OIL Worker" );
  +      category.info("JBossMQ OIL service available at : " + 
InetAddress.getLocalHost().getHostAddress() + ":" + serverSocket.getLocalPort());
  +      worker = new Thread(server.threadGroup, this, "OIL Worker");
         worker.start();
   
  -      serverIL = new OILServerIL( InetAddress.getLocalHost(), 
serverSocket.getLocalPort() );
  +      serverIL = new OILServerIL(InetAddress.getLocalHost(), 
serverSocket.getLocalPort());
   
         bindJNDIReferences();
   
  @@ -144,16 +142,24 @@
      /**
       *  Stops this IL, and unbinds it from JNDI
       */
  -   public void stopService() {
  -      try {
  +   public void stopService()
  +   {
  +      try
  +      {
            running = false;
            unbindJNDIReferences();
  -      } catch ( Exception e ) {
  +      }
  +      catch (Exception e)
  +      {
            e.printStackTrace();
         }
      }
   
  -   public void run() {
  +   /**
  +    *  Main processing method for the OILServerILService object
  +    */
  +   public void run()
  +   {
   
         Socket socket = null;
         int code = 0;
  @@ -162,170 +168,208 @@
         ConnectionToken connectionToken = null;
         boolean closed = false;
   
  -      try {
  -         while ( running && socket == null ) {
  -            try {
  +      try
  +      {
  +         while (running && socket == null)
  +         {
  +            try
  +            {
                  socket = serverSocket.accept();
  -            } catch ( java.io.InterruptedIOException e ) {
  +            }
  +            catch (java.io.InterruptedIOException e)
  +            {
               }
            }
   
  -         if ( !running ) {
  +         if (!running)
  +         {
               return;
            }
   
  -         socket.setSoTimeout( 0 );
  -         new Thread( this, "OIL Worker" ).start();
  +         socket.setSoTimeout(0);
  +         new Thread(this, "OIL Worker").start();
   
  -         out = new ObjectOutputStream( new BufferedOutputStream( 
socket.getOutputStream() ) );
  +         out = new ObjectOutputStream(new 
BufferedOutputStream(socket.getOutputStream()));
            out.flush();
  -         in = new ObjectInputStream( new BufferedInputStream( 
socket.getInputStream() ) );
  +         in = new ObjectInputStream(new 
BufferedInputStream(socket.getInputStream()));
   
  -      } catch ( IOException e ) {
  -         category.warn( "Could not initialize the OILServerIL Service.", e );
  +      }
  +      catch (IOException e)
  +      {
  +         category.warn("Could not initialize the OILServerIL Service.", e);
            running = false;
            return;
         }
   
  -      while ( !closed && running ) {
  +      while (!closed && running)
  +      {
   
  -         try {
  +         try
  +         {
               code = in.readByte();
  -         } catch ( EOFException e ) {
  +         }
  +         catch (EOFException e)
  +         {
               break;
  -         } catch ( IOException e ) {
  -            if ( closed || !running ) {
  +         }
  +         catch (IOException e)
  +         {
  +            if (closed || !running)
  +            {
                  break;
               }
  -            category.warn( "Connection failure (1).", e );
  +            category.warn("Connection failure (1).", e);
               break;
            }
   
  -         try {
  +         try
  +         {
   
               Object result = null;
   
  -            switch ( code ) {
  +            switch (code)
  +            {
                  case m_setSpyDistributedConnection:
  -                  connectionToken = ( ConnectionToken )in.readObject();
  -                  category.debug( "The OILClientIL Connection is set up" );
  +                  connectionToken = (ConnectionToken)in.readObject();
  +                  category.debug("The OILClientIL Connection is set up");
                     break;
                  case m_acknowledge:
                     AcknowledgementRequest ack = new AcknowledgementRequest();
  -                  ack.readExternal( in );
  -                  server.acknowledge( connectionToken, ack );
  +                  ack.readExternal(in);
  +                  server.acknowledge(connectionToken, ack);
                     break;
                  case m_addMessage:
  -                  server.addMessage( connectionToken, SpyMessage.readMessage( in ) 
);
  +                  server.addMessage(connectionToken, SpyMessage.readMessage(in));
                     break;
                  case m_browse:
  -                  result = server.browse( connectionToken, ( Destination 
)in.readObject(), ( String )in.readObject() );
  +                  result = server.browse(connectionToken, 
(Destination)in.readObject(), (String)in.readObject());
                     break;
                  case m_checkID:
  -                  server.checkID( ( String )in.readObject() );
  +                  server.checkID((String)in.readObject());
                     break;
                  case m_connectionClosing:
  -                  server.connectionClosing( connectionToken );
  +                  server.connectionClosing(connectionToken);
                     closed = true;
                     break;
                  case m_createQueue:
  -                  result = ( Queue )server.createQueue( connectionToken, ( String 
)in.readObject() );
  +                  result = (Queue)server.createQueue(connectionToken, 
(String)in.readObject());
                     break;
                  case m_createTopic:
  -                  result = ( Topic )server.createTopic( connectionToken, ( String 
)in.readObject() );
  +                  result = (Topic)server.createTopic(connectionToken, 
(String)in.readObject());
                     break;
                  case m_deleteTemporaryDestination:
  -                  server.deleteTemporaryDestination( connectionToken, ( 
SpyDestination )in.readObject() );
  +                  server.deleteTemporaryDestination(connectionToken, 
(SpyDestination)in.readObject());
                     break;
                  case m_getID:
                     result = server.getID();
                     break;
                  case m_getTemporaryQueue:
  -                  result = ( TemporaryQueue )server.getTemporaryQueue( 
connectionToken );
  +                  result = 
(TemporaryQueue)server.getTemporaryQueue(connectionToken);
                     break;
                  case m_getTemporaryTopic:
  -                  result = ( TemporaryTopic )server.getTemporaryTopic( 
connectionToken );
  +                  result = 
(TemporaryTopic)server.getTemporaryTopic(connectionToken);
                     break;
                  case m_receive:
  -                  result = server.receive( connectionToken, in.readInt(), 
in.readLong() );
  +                  result = server.receive(connectionToken, in.readInt(), 
in.readLong());
                     break;
                  case m_setEnabled:
  -                  server.setEnabled( connectionToken, in.readBoolean() );
  +                  server.setEnabled(connectionToken, in.readBoolean());
                     break;
                  case m_subscribe:
  -                  server.subscribe( connectionToken, ( Subscription 
)in.readObject() );
  +                  server.subscribe(connectionToken, (Subscription)in.readObject());
                     break;
                  case m_transact:
                     TransactionRequest trans = new TransactionRequest();
  -                  trans.readExternal( in );
  -                  server.transact( connectionToken, trans );
  +                  trans.readExternal(in);
  +                  server.transact(connectionToken, trans);
                     break;
                  case m_unsubscribe:
  -                  server.unsubscribe( connectionToken, in.readInt() );
  +                  server.unsubscribe(connectionToken, in.readInt());
                     break;
                  case m_destroySubscription:
  -                  server.destroySubscription( ( DurableSubcriptionID 
)in.readObject() );
  +                  server.destroySubscription((DurableSubcriptionID)in.readObject());
                     break;
                  case m_checkUser:
  -                  result = server.checkUser( ( String )in.readObject(), ( String 
)in.readObject() );
  +                  result = server.checkUser((String)in.readObject(), 
(String)in.readObject());
                     break;
                  default:
  -                  throw new RemoteException( "Bad method code !" );
  +                  throw new RemoteException("Bad method code !");
               }
   
               //Everthing was OK
   
  -            try {
  -               if ( result == null ) {
  -                  out.writeByte( 0 );
  -               } else {
  -                  out.writeByte( 1 );
  -                  out.writeObject( result );
  +            try
  +            {
  +               if (result == null)
  +               {
  +                  out.writeByte(0);
  +               }
  +               else
  +               {
  +                  out.writeByte(1);
  +                  out.writeObject(result);
                     out.reset();
                  }
                  out.flush();
  -            } catch ( IOException e ) {
  -               if ( closed ) {
  +            }
  +            catch (IOException e)
  +            {
  +               if (closed)
  +               {
                     break;
                  }
   
  -               category.warn( "Connection failure (2).", e );
  +               category.warn("Connection failure (2).", e);
                  break;
               }
   
  -         } catch ( Exception e ) {
  -            if ( closed ) {
  +         }
  +         catch (Exception e)
  +         {
  +            if (closed)
  +            {
                  break;
               }
   
  -            category.info( "Client request resulted in a server exception: ", e );
  +            category.info("Client request resulted in a server exception: ", e);
   
  -            try {
  -               out.writeByte( 2 );
  -               out.writeObject( e );
  +            try
  +            {
  +               out.writeByte(2);
  +               out.writeObject(e);
                  out.reset();
                  out.flush();
  -            } catch ( IOException e2 ) {
  -               if ( closed ) {
  +            }
  +            catch (IOException e2)
  +            {
  +               if (closed)
  +               {
                     break;
                  }
   
  -               category.warn( "Connection failure (3).", e );
  +               category.warn("Connection failure (3).", e);
                  break;
               }
            }
         }
   
  -      try {
  -         if ( !closed ) {
  -            try {
  -               server.connectionClosing( connectionToken );
  -            } catch ( JMSException e ) {
  +      try
  +      {
  +         if (!closed)
  +         {
  +            try
  +            {
  +               server.connectionClosing(connectionToken);
  +            }
  +            catch (JMSException e)
  +            {
               }
            }
            socket.close();
  -      } catch ( IOException e ) {
  -         category.warn( "Connection failure during connection close.", e );
  +      }
  +      catch (IOException e)
  +      {
  +         category.warn("Connection failure during connection close.", e);
         }
   
      }
  
  
  

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

Reply via email to