## org.beepcore.beep.lib
Class SharedChannel

    java.lang.Object
      org.beepcore.beep.lib.SharedChannel

All Implemented Interfaces:
  Channel

public class SharedChannel
extends java.lang.Object
implements Channel

`SharedChannel` references a `Channel`. A `ChannelPool` holds a collection of `SharedChannel`s. Call `ChannelPoll`'s `getSharedChannel` to create a `SharedChannel`.

See Also:
  `ChannelPool`

Field Summary

Fields inherited from interface org.beepcore.beep.core.Channel
`STATE_ABORTED, STATE_ACTIVE, STATE_CLOSE_PENDING, STATE_CLOSED, STATE_CLOSING, STATE_INITIALIZED, STATE_STARTING, STATE_TUNING, STATE_TUNING_PENDING`

Method Summary
`void` `close()` Closes this `SharedChannel`.
`java.lang.Object` `getAppData()` Returns application context data previously set using `setAppData()`.
`MessageListener` `getMessageListener()` Returns the message listener for this channel.
`int` `getNumber()` Return the number of this `Channel`.
`java.lang.String` `getProfile()` Returns the profile used to create this `SharedChannel`.
`RequestHandler` `getRequestHandler()` Returns the `RequestHandler` registered with this channel.
`Session` `getSession()` Returns the session for this channel.
`java.lang.String` `getStartData()`
`int` `getState()` Returns the state of this channel.
`void` `release()` Marks this `SharedChannel` as available for reuse.
`MessageStatus` `sendMSG(OutputDataStream stream, ReplyListener replyListener)` Send a message of type MSG.
`Reply` `sendRequest(OutputDataStream ds)` Sends a 'synchronous' request on this `SharedChannel`.
`void` `setAppData(java.lang.Object applicationData)` Set the application context data.
`MessageListener` `setMessageListener(MessageListener ml)` Sets the `DataListener` for this `SharedChannel`.
`RequestHandler` `setRequestHandler(RequestHandler handler)` Sets the MSG handler for this `Channel`.
`RequestHandler` `setRequestHandler(RequestHandler handler, boolean tuningReset)` Sets the MSG handler for this `Channel`.
`void` `setStartData(java.lang.String data)`

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

Method Detail

### release

    public void release()

  Marks this `SharedChannel` as available for reuse.

### sendMSG

    public MessageStatus sendMSG(OutputDataStream stream,
                                 ReplyListener replyListener)
                          throws BEEPException

  Send a message of type MSG. Sends `stream` as message's payload.

  Specified by:
    `sendMSG` in interface `Channel`
  Parameters:
    `stream` - `DataStream` that is read to send data.
    `replyListener` -
  Returns:
    MessageStatus Can be queried to get status information about the message.
  Throws:
    `BEEPException`
  See Also:
    `OutputDataStream`, `MessageStatus`

### setMessageListener

    public MessageListener setMessageListener(MessageListener ml)

  Sets the `DataListener` for this `SharedChannel`.

  Specified by:
    `setMessageListener` in interface `Channel`
  Parameters:
    `ml` - A listener of type `DataListener`
  Returns:
    The previous MessageListener or null if none was set.

### getMessageListener

    public MessageListener getMessageListener()

  Description copied from interface: `Channel`
  Returns the message listener for this channel.

  Specified by:
    `getMessageListener` in interface `Channel`

### getRequestHandler

    public RequestHandler getRequestHandler()

  Description copied from interface: `Channel`
  Returns the `RequestHandler` registered with this channel.

  Specified by:
    `getRequestHandler` in interface `Channel`

### setRequestHandler

    public RequestHandler setRequestHandler(RequestHandler handler)

  Description copied from interface: `Channel`
  Sets the MSG handler for this `Channel`.

  Specified by:
    `setRequestHandler` in interface `Channel`
  Parameters:
    `handler` - `RequestHandler` to handle received MSG messages.
  Returns:
    The previous `RequestHandler` or `null` if one wasn't set.

### setRequestHandler

    public RequestHandler setRequestHandler(RequestHandler handler,
                                            boolean tuningReset)

  Description copied from interface: `Channel`
  Sets the MSG handler for this `Channel`.

  Specified by:
    `setRequestHandler` in interface `Channel`
  Parameters:
    `handler` - `RequestHandler` to handle received MSG messages.
    `tuningReset` - flag indicating that the profile will request a tuning reset.
  Returns:
    The previous `RequestHandler` or `null` if one wasn't set.

### getNumber

    public int getNumber()

  Description copied from interface: `Channel`
  Return the number of this `Channel`.

  Specified by:
    `getNumber` in interface `Channel`

### getSession

    public Session getSession()

  Description copied from interface: `Channel`
  Returns the session for this channel.

  Specified by:
    `getSession` in interface `Channel`

### getState

    public int getState()

  Description copied from interface: `Channel`
  Returns the state of this channel.

  Specified by:
    `getState` in interface `Channel`

### getProfile

    public java.lang.String getProfile()

  Returns the profile used to create this `SharedChannel`.

  Specified by:
    `getProfile` in interface `Channel`

### close

    public void close()
               throws BEEPException

  Closes this `SharedChannel`.

  Specified by:
    `close` in interface `Channel`
  Throws:
    `BEEPException`

### sendRequest

    public Reply sendRequest(OutputDataStream ds)
                      throws BEEPException

  Sends a 'synchronous' request on this `SharedChannel`.

  Parameters:
    `ds` - `DataStream` to send as this request's payload.
  Returns:
    Reply Caller may block using this object to retrieve the reply to this request.
  Throws:
    `BEEPException`

### setStartData

    public void setStartData(java.lang.String data)

  Specified by:
    `setStartData` in interface `Channel`

### getStartData

    public java.lang.String getStartData()

  Specified by:
    `getStartData` in interface `Channel`

### getAppData

    public java.lang.Object getAppData()

  Description copied from interface: `Channel`
  Returns application context data previously set using `setAppData()`.

  Specified by:
    `getAppData` in interface `Channel`
  See Also:
    `Channel.setAppData(java.lang.Object)`

### setAppData

    public void setAppData(java.lang.Object applicationData)

  Description copied from interface: `Channel`
  Set the application context data.

  Specified by:
    `setAppData` in interface `Channel`
  See Also:
    `Channel.getAppData()`

Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.