All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iBus.layers.TCP

java.lang.Object
   |
   +----iBus.ProtocolObject
           |
           +----iBus.layers.TCP

public class TCP
extends ProtocolObject

TCP: TCP protocol object

TCP is used for push and pull communication via a point-to-point TCP link

PARAMETERS:

POSITION IN STACK:

USAGE:

DESIGN:

EVENTS PRODUCED:

EVENTS HANDLED:

EVENTS CONSUMED:

THREADS:


Variable Index

 o bufSize_
 o log_

Constructor Index

 o TCP()
Create an TCP protocol object

Method Index

 o checkThrottle()
Called by TCP_ListenerThread.run to suspend reception of further messages when the event queue of the stack is full.
 o createInputStream(InputStream)
Factory method for input stream creation.
 o createOutputStream(OutputStream)
Factory method for output stream creation.
 o dnFlush()
Flush the protocol object.
 o dnGetStackURL()
Called by the API protocol object to obtain an URL used to reply to this stack.
 o dnInit()
Initialize the protocol object after the protocol stack is created.
 o dnPull(iBusURL, MessageEvent)
Called by the object above to issue a blocking pull request.
 o dnPullReply(MessageEvent, PullContext, MessageEvent)
Reply to a pull request.
 o dnPush(iBusURL, MessageEvent)
Called by the object above to send a message to a channel by multicast or unicast communication, depending on the channel URL:
 o dnRegisterTalker(iBusURL)
Called by the object above or by an iBus application to register as a talker for a channel.
 o dnSubscribe(iBusURL)
Called by the object above to subscribe to a channel.
 o dnTerminate()
Terminate any threads in the protocol object.
 o dnThrottle(boolean)
The stack is getting overloaded.
 o dnUnregisterTalker(iBusURL)
Called by the object above or by an iBus application to unregister as a talker from a channel.
 o dnUnsubscribe(iBusURL)
Called by the object above or by an iBus application to unsubscribe from a certain channel.

Variables

 o bufSize_
 protected static int bufSize_
 o log_
 protected static final Log log_

Constructors

 o TCP
 public TCP()
Create an TCP protocol object

Methods

 o dnInit
 public void dnInit()
Initialize the protocol object after the protocol stack is created. Also checks whether the right parameters were given to the protocol object.

Overrides:
dnInit in class ProtocolObject
 o dnFlush
 public void dnFlush()
Flush the protocol object. Deliver any buffered messages, call flush on any output streams.

Overrides:
dnFlush in class ProtocolObject
 o dnTerminate
 public void dnTerminate()
Terminate any threads in the protocol object.

Overrides:
dnTerminate in class ProtocolObject
 o dnPush
 public void dnPush(iBusURL channel,
                    MessageEvent msg) throws CommException, NotRegistered
Called by the object above to send a message to a channel by multicast or unicast communication, depending on the channel URL:

Parameters:
channel - the destination channel of the posting
msg - the message to be sent
Throws: CommException
on communication failure
Throws: NotRegistered
in case registerTalker was not called for the channel
Overrides:
dnPush in class ProtocolObject
 o dnPull
 public synchronized MessageEvent[] dnPull(iBusURL channel,
                                           MessageEvent msg) throws CommException, NotRegistered
Called by the object above to issue a blocking pull request.

Parameters:
channel - the destination channel of the posting
msg - the request message to be sent
Returns:
an array of zero or more reply messages
Throws: CommException
on communication failure
Throws: NotRegistered
in case registerTalker was not called for the channel
Overrides:
dnPull in class ProtocolObject
 o dnPullReply
 public void dnPullReply(MessageEvent reply,
                         PullContext pctx,
                         MessageEvent request) throws CommException
Reply to a pull request.

Parameters:
reply - the reply message to return
pctx - the context of the associated pull request
request - the request message
Throws: CommException
on communication failure
Overrides:
dnPullReply in class ProtocolObject
 o dnSubscribe
 public synchronized void dnSubscribe(iBusURL channel) throws AlreadySubscribed, CommException
Called by the object above to subscribe to a channel.

Parameters:
channel - the channel to subscribe to
Throws: AlreadySubscribed
if this stack is already subscribed to the channel
Throws: CommException
in case of a communication error
Overrides:
dnSubscribe in class ProtocolObject
 o dnUnsubscribe
 public synchronized void dnUnsubscribe(iBusURL channel) throws NotSubscribed, CommException
Called by the object above or by an iBus application to unsubscribe from a certain channel.

Parameters:
channel - the channel to unsubscribe from
Throws: NotSubscribed
if this stack is not subscribed to the channel
Throws: CommException
in case of a communication error
Overrides:
dnUnsubscribe in class ProtocolObject
 o dnRegisterTalker
 public synchronized void dnRegisterTalker(iBusURL channel) throws AlreadyRegistered, CommException
Called by the object above or by an iBus application to register as a talker for a channel.

Parameters:
channel - the channel to register for
Throws: AlreadyRegistered
if this stack is already registered for the channel
Throws: CommException
in case of a communication error
Overrides:
dnRegisterTalker in class ProtocolObject
 o dnUnregisterTalker
 public synchronized void dnUnregisterTalker(iBusURL channel) throws NotRegistered, CommException
Called by the object above or by an iBus application to unregister as a talker from a channel.

Parameters:
channel - the channel to unregister from
Throws: NotRegistered
if this stack is not registered with the channel
Throws: CommException
in case of a communication error
Overrides:
dnUnregisterTalker in class ProtocolObject
 o checkThrottle
 protected void checkThrottle()
Called by TCP_ListenerThread.run to suspend reception of further messages when the event queue of the stack is full. NOTE: a deadlock occurs if this method is tagged synchronized, and both client and server are in the same JVM.

 o dnGetStackURL
 public synchronized iBusURL dnGetStackURL()
Called by the API protocol object to obtain an URL used to reply to this stack. dnGetStackURL is typically implemented by the bottommost protocol object only.

Returns:
the URL of the stack
Overrides:
dnGetStackURL in class ProtocolObject
 o dnThrottle
 public synchronized void dnThrottle(boolean stop)
The stack is getting overloaded. Tell the senders to slow down the rate at which they send messages to us.

Parameters:
stop - true if throttling is required, false if unthrottling is required.
Overrides:
dnThrottle in class ProtocolObject
 o createOutputStream
 protected static OutputStream createOutputStream(OutputStream os)
Factory method for output stream creation.

Parameters:
os - the low level output stream to write to
Returns:
the output stream to use
 o createInputStream
 protected static InputStream createInputStream(InputStream is)
Factory method for input stream creation.

Parameters:
is - the low level input stream to read from
Returns:
the input stream to use

All Packages  Class Hierarchy  This Package  Previous  Next  Index