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

  Modified:    src/main/org/jboss/mq/il/uil UILServerILService.java
  Log:
  Fixing compile problems due to migration of classes from jboss.util to jboss.system
  
  Revision  Changes    Path
  1.4       +145 -102  jbossmq/src/main/org/jboss/mq/il/uil/UILServerILService.java
  
  Index: UILServerILService.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/uil/UILServerILService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UILServerILService.java   2001/08/30 02:35:54     1.3
  +++ UILServerILService.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,11 +21,10 @@
   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;
  @@ -44,22 +40,14 @@
   import org.jboss.mq.il.uil.multiplexor.*;
   import org.jboss.mq.server.JMSServer;
   
  -import org.jboss.system.ServiceMBeanSupport;
  -
   /**
    *  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 UILServerILService extends org.jboss.mq.il.ServerILJMXService 
implements Runnable, UILServerILServiceMBean {
  -   protected ServerSocket serverSocket;
  -   UILServerIL      serverIL;
  -
  -   boolean          running;
  -   int              serverBindPort = 0;
  -   Thread           worker;
  +public class UILServerILService extends org.jboss.mq.il.ServerILJMXService 
implements Runnable, UILServerILServiceMBean
  +{
      //The server implementation
      protected static JMSServer server;
   
  @@ -84,13 +72,20 @@
      final static int m_destroySubscription = 19;
      final static int m_checkUser = 20;
      final static int SO_TIMEOUT = 5000;
  +   protected ServerSocket serverSocket;
  +   UILServerIL 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-UILServerIL";
      }
   
  @@ -101,7 +96,8 @@
       * @return     The ServerIL value
       * @returns    ServerIL the instance of this IL
       */
  -   public ServerIL getServerIL() {
  +   public ServerIL getServerIL()
  +   {
         return serverIL;
      }
   
  @@ -112,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.uil.UILClientILService" );
  +      rc.setProperty(GenericConnectionFactory.CLIENT_IL_SERVICE_KEY, 
"org.jboss.mq.il.uil.UILClientILService");
         return rc;
      }
   
  @@ -123,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 UIL service available at : " + 
InetAddress.getLocalHost().getHostAddress() + ":" + serverSocket.getLocalPort() );
  -      worker = new Thread( server.threadGroup, this, "UIL Worker" );
  +      category.info("JBossMQ UIL service available at : " + 
InetAddress.getLocalHost().getHostAddress() + ":" + serverSocket.getLocalPort());
  +      worker = new Thread(server.threadGroup, this, "UIL Worker");
         worker.start();
   
  -      serverIL = new UILServerIL( InetAddress.getLocalHost(), 
serverSocket.getLocalPort() );
  +      serverIL = new UILServerIL(InetAddress.getLocalHost(), 
serverSocket.getLocalPort());
   
         bindJNDIReferences();
   
  @@ -145,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 UILServerILService object
  +    */
  +   public void run()
  +   {
         Socket socket = null;
         SocketMultiplexor mSocket = null;
         int code = 0;
  @@ -163,179 +168,217 @@
         ConnectionToken connectionToken = null;
         boolean closed = false;
   
  -      try {
  +      try
  +      {
   
  -         while ( running && socket == null ) {
  -            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, "UIL Worker" ).start();
  +         socket.setSoTimeout(0);
  +         new Thread(this, "UIL Worker").start();
   
  -         mSocket = new SocketMultiplexor( socket );
  +         mSocket = new SocketMultiplexor(socket);
   
  -         out = new ObjectOutputStream( new BufferedOutputStream( 
mSocket.getOutputStream( 1 ) ) );
  +         out = new ObjectOutputStream(new 
BufferedOutputStream(mSocket.getOutputStream(1)));
            out.flush();
   
  -         in = new ObjectInputStream( new BufferedInputStream( 
mSocket.getInputStream( 1 ) ) );
  +         in = new ObjectInputStream(new 
BufferedInputStream(mSocket.getInputStream(1)));
   
  -      } catch ( IOException e ) {
  -         category.warn( "Could not initialize the UILServerIL Service.", e );
  +      }
  +      catch (IOException e)
  +      {
  +         category.warn("Could not initialize the UILServerIL 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:
  -                  category.debug( "Setting up the UILClientIL Connection" );
  -                  connectionToken = ( ConnectionToken )in.readObject();
  -                  ( ( UILClientIL )connectionToken.clientIL ).mSocket = mSocket;
  -                  ( ( UILClientIL )connectionToken.clientIL ).createConnection();
  -                  category.debug( "The UILClientIL Connection is set up" );
  +                  category.debug("Setting up the UILClientIL Connection");
  +                  connectionToken = (ConnectionToken)in.readObject();
  +                  ((UILClientIL)connectionToken.clientIL).mSocket = mSocket;
  +                  ((UILClientIL)connectionToken.clientIL).createConnection();
  +                  category.debug("The UILClientIL 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 {
  +      try
  +      {
   
  -         if ( !closed ) {
  -            try {
  -               server.connectionClosing( connectionToken );
  -            } catch ( JMSException ignore ) {
  +         if (!closed)
  +         {
  +            try
  +            {
  +               server.connectionClosing(connectionToken);
  +            }
  +            catch (JMSException ignore)
  +            {
               }
            }
            mSocket.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