Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.mq.il.uil2
Class SocketManager

    java.lang.Object
      org.jboss.mq.il.uil2.SocketManager

public class SocketManager
extends Object

Used to manage the client/server and server/client communication in an asynchrounous manner.

Version:
  $Revision: 1.14.2.2.2.1 $
Author:
  Scott.Stark@jboss.org

Nested Class Summary
`class` | `SocketManager.ReadTask` The task managing the socket read thread
`class` | `SocketManager.WriteTask` The task managing the socket write thread

Constructor Summary
`SocketManager(Socket s)`

Method Summary
`void` | `sendMessage(BaseMsg msg)` Send a two-way message and block the calling thread until the msg reply is received.
`void` | `sendReply(BaseMsg msg)` Send a one-way message.
`void` | `setBufferSize(int size)` Sets the buffer size
`void` | `setChunkSize(int size)` Sets the chunk size
`void` | `setHandler(SocketManagerHandler handler)` Set the callback handler for msgs that were not originated by the socket manager.
`void` | `start(ThreadGroup tg)` Start the read and write threads using the given thread group and names of "UIL2.SocketManager.ReadTask" and "UIL2.SocketManager.WriteTask".
`void` | `stop()` Stop the read and write threads by interrupting them.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SocketManager

    public SocketManager(Socket s)
                  throws IOException

Method Detail

### start

    public void start(ThreadGroup tg)

  Start the read and write threads using the given thread group and names of "UIL2.SocketManager.ReadTask" and "UIL2.SocketManager.WriteTask".

  Parameters:
    `tg` - the thread group to use for the read and write threads.

### stop

    public void stop()

  Stop the read and write threads by interrupting them.

### setHandler

    public void setHandler(SocketManagerHandler handler)

  Set the callback handler for msgs that were not originated by the socket manager. This is any msgs read that was not sent via the sendMessage method.

  Parameters:
    `handler` -

### setBufferSize

    public void setBufferSize(int size)

  Sets the buffer size

  Parameters:
    `size` - the size of the buffer

### setChunkSize

    public void setChunkSize(int size)

  Sets the chunk size

  Parameters:
    `size` - the size of a chunk

### sendMessage

    public void sendMessage(BaseMsg msg)
                     throws Exception

  Send a two-way message and block the calling thread until the msg reply is received. This enques the msg to the sendQueue, places the msg in the replyMap and waits on the msg. The msg is notified by the read task thread when it finds a msg with a msgID that maps to the msg in the msgReply map.

  Parameters:
    `msg` - the request msg to send
  Throws:
    `Exception` - thrown if the reply message has an error value

### sendReply

    public void sendReply(BaseMsg msg)
                   throws Exception

  Send a one-way message. Typically this is a reply message, but it could be an asynchronous msg that does not need a reply as it true for ping msgs.

  Parameters:
    `msg` -
  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.