|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.root1.simon.Dispatcher
public class Dispatcher
This class is the "brain" of SIMON on server side, as well as on client side. It handles all the I/O and delegates the required tasks
Constructor Summary | |
---|---|
Dispatcher(java.lang.String serverString,
java.util.concurrent.ExecutorService threadPool)
Creates a packet dispatcher which delegates the packet-reading to ProcessMessageRunnable 's which run in the given threadPool |
Method Summary | |
---|---|
protected void |
addClosedListener(ClosedListener listener,
java.lang.String remoteObjectName)
Method used by the Lookup-Classes to register a closed listener with a given remote object name |
protected void |
closeRawChannel(org.apache.mina.core.session.IoSession session,
int channelToken)
Triggers a close of a raw channel |
void |
exceptionCaught(org.apache.mina.core.session.IoSession session,
java.lang.Throwable throwable)
|
protected java.util.List<ClosedListener> |
getClosedListenerList(java.lang.String remoteObjectName)
Returns a list of ClosedListeners which listen for closed event for given remote object name |
protected LookupTable |
getLookupTable()
for internal use only |
protected int |
getPingTimeout()
Method used by the PingWatchdog for getting the current ping/keepalive timeout |
protected PingWatchdog |
getPingWatchdog()
Returns the PingWatchdog that checks the session connectivity |
protected RawChannelDataListener |
getRawChannelDataListener(int channelToken)
TODO document me |
java.lang.String |
getServerString()
Returns the identifier string which determines to which server this dispatcher is connected to |
protected boolean |
invokeEquals(org.apache.mina.core.session.IoSession session,
java.lang.String remoteObjectName,
java.lang.Object objectToCompareWith)
Forwards an "equals()" call to the remote side to be handled there |
protected int |
invokeHashCode(org.apache.mina.core.session.IoSession session,
java.lang.String remoteObjectName)
Invokes the hashCode() method on the remote object |
protected MsgInterfaceLookupReturn |
invokeInterfaceLookup(org.apache.mina.core.session.IoSession session,
java.lang.String canonicalInterfaceName)
Sends a remote object lookup to the server |
protected java.lang.Object |
invokeMethod(org.apache.mina.core.session.IoSession session,
java.lang.String remoteObjectName,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected MsgNameLookupReturn |
invokeNameLookup(org.apache.mina.core.session.IoSession session,
java.lang.String remoteObjectName)
Sends a remote object lookup to the server |
protected java.lang.String |
invokeToString(org.apache.mina.core.session.IoSession session,
java.lang.String remoteObjectName)
Sends a "toString()" request to the remote host. |
protected boolean |
isRawChannelDataListenerRegistered(int channelToken)
TODO document me |
protected boolean |
isRunning()
Returns whether the dispatcher is still in run() or not |
protected boolean |
isServerDispatcher()
Returns whether this is an server dispatcher or not |
void |
messageReceived(org.apache.mina.core.session.IoSession session,
java.lang.Object message)
|
void |
messageSent(org.apache.mina.core.session.IoSession session,
java.lang.Object msg)
|
protected RawChannel |
openRawChannel(org.apache.mina.core.session.IoSession session,
int channelToken)
Opens the a raw channel on the given session with the specified token |
protected int |
prepareRawChannel(RawChannelDataListener listener)
TODO document me |
void |
putResultToQueue(org.apache.mina.core.session.IoSession session,
int sequenceId,
java.lang.Object o)
This method is called from worker-threads which processed an invocation and have data ready that has to be returned to the "caller". |
protected boolean |
removeClosedListener(ClosedListener listener,
java.lang.String remoteObjectName)
Method used by the lookup-Classes to remove a single closed listener from a remote object |
protected java.util.List<ClosedListener> |
removeClosedListenerList(java.lang.String remoteObjectName)
Method used by the Loopup-Classes to remove a list of closed listener for a given remote object |
void |
sendPong(org.apache.mina.core.session.IoSession session)
|
void |
sessionClosed(org.apache.mina.core.session.IoSession session)
|
void |
sessionCreated(org.apache.mina.core.session.IoSession session)
|
void |
sessionIdle(org.apache.mina.core.session.IoSession session,
org.apache.mina.core.session.IdleStatus idleStatus)
|
void |
sessionOpened(org.apache.mina.core.session.IoSession session)
|
protected void |
setPingTimeOut(int pingTimeOut)
Method used by the Registry while setting the keep alive timeout |
void |
shutdown()
Initiates a shutdown at the dispatcher and all related things |
protected void |
unprepareRawChannel(int channelToken)
TODO document me |
protected void |
writeRawData(org.apache.mina.core.session.IoSession session,
int channelToken,
java.nio.ByteBuffer byteBuffer)
TODO document me |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Dispatcher(java.lang.String serverString, java.util.concurrent.ExecutorService threadPool)
ProcessMessageRunnable
's which run in the given threadPool
serverString
- an identifier string to determine to which server this dispatcher is
connected to. this must be set to null
if this dispatcher is a server dispatcher.threadPool
- the pool where the ProcessMessageRunnable
's run inMethod Detail |
---|
protected int getPingTimeout()
protected void setPingTimeOut(int pingTimeOut)
pingTimeOut
- the pingTimeOut to setprotected java.util.List<ClosedListener> removeClosedListenerList(java.lang.String remoteObjectName)
remoteObjectName
- the remote object that correlates to the closed listenert
protected void addClosedListener(ClosedListener listener, java.lang.String remoteObjectName)
listener
- the listener to addremoteObjectName
- the obejct that we listen for closed situationsprotected boolean removeClosedListener(ClosedListener listener, java.lang.String remoteObjectName)
listener
- the listener to removeremoteObjectName
- the related remote objectprotected MsgNameLookupReturn invokeNameLookup(org.apache.mina.core.session.IoSession session, java.lang.String remoteObjectName) throws LookupFailedException, SimonRemoteException
session
- the related session over which the invoke request comesremoteObjectName
- the remote object to lookup
SimonRemoteException
LookupFailedException
protected MsgInterfaceLookupReturn invokeInterfaceLookup(org.apache.mina.core.session.IoSession session, java.lang.String canonicalInterfaceName) throws LookupFailedException, SimonRemoteException
session
- the related session over which the invoke request comescanonicalInterfaceName
- the canonical name of the interface
SimonRemoteException
LookupFailedException
protected java.lang.Object invokeMethod(org.apache.mina.core.session.IoSession session, java.lang.String remoteObjectName, java.lang.reflect.Method method, java.lang.Object[] args) throws SimonRemoteException
SimonRemoteException
protected java.lang.String invokeToString(org.apache.mina.core.session.IoSession session, java.lang.String remoteObjectName) throws SimonRemoteException
session
- the related session over which the invoke request comesremoteObjectName
- the remote object
SimonRemoteException
protected int invokeHashCode(org.apache.mina.core.session.IoSession session, java.lang.String remoteObjectName) throws SimonRemoteException
session
- the related session over which the invoke request comesremoteObjectName
- the remote object
SimonRemoteException
protected boolean invokeEquals(org.apache.mina.core.session.IoSession session, java.lang.String remoteObjectName, java.lang.Object objectToCompareWith) throws SimonRemoteException
session
- the session to which the invocation is sentremoteObjectName
- the name of the remote object that has to be comparedobjectToCompareWith
- the object to which the remote object is compared with
SimonRemoteException
public void putResultToQueue(org.apache.mina.core.session.IoSession session, int sequenceId, java.lang.Object o)
sequenceId
- the sequence id that is waiting for the resulto
- the result itselfprotected LookupTable getLookupTable()
public void shutdown()
public java.lang.String getServerString()
null
if this dispatcher is a server dispatcherprotected boolean isServerDispatcher()
protected boolean isRunning()
public void exceptionCaught(org.apache.mina.core.session.IoSession session, java.lang.Throwable throwable) throws java.lang.Exception
exceptionCaught
in interface org.apache.mina.core.service.IoHandler
java.lang.Exception
public void messageReceived(org.apache.mina.core.session.IoSession session, java.lang.Object message) throws java.lang.Exception
messageReceived
in interface org.apache.mina.core.service.IoHandler
java.lang.Exception
public void messageSent(org.apache.mina.core.session.IoSession session, java.lang.Object msg) throws java.lang.Exception
messageSent
in interface org.apache.mina.core.service.IoHandler
java.lang.Exception
public void sessionClosed(org.apache.mina.core.session.IoSession session) throws java.lang.Exception
sessionClosed
in interface org.apache.mina.core.service.IoHandler
java.lang.Exception
public void sessionCreated(org.apache.mina.core.session.IoSession session) throws java.lang.Exception
sessionCreated
in interface org.apache.mina.core.service.IoHandler
java.lang.Exception
public void sessionIdle(org.apache.mina.core.session.IoSession session, org.apache.mina.core.session.IdleStatus idleStatus) throws java.lang.Exception
sessionIdle
in interface org.apache.mina.core.service.IoHandler
java.lang.Exception
public void sendPong(org.apache.mina.core.session.IoSession session) throws SessionException
SessionException
public void sessionOpened(org.apache.mina.core.session.IoSession session) throws java.lang.Exception
sessionOpened
in interface org.apache.mina.core.service.IoHandler
java.lang.Exception
protected RawChannel openRawChannel(org.apache.mina.core.session.IoSession session, int channelToken) throws SimonRemoteException
SimonRemoteException
- if a problem occured while opening the raw channelprotected int prepareRawChannel(RawChannelDataListener listener) throws SimonException
SimonException
protected boolean isRawChannelDataListenerRegistered(int channelToken)
protected RawChannelDataListener getRawChannelDataListener(int channelToken)
protected void unprepareRawChannel(int channelToken)
channelToken
- protected void writeRawData(org.apache.mina.core.session.IoSession session, int channelToken, java.nio.ByteBuffer byteBuffer) throws SimonRemoteException
session
- channelToken
- byteBuffer
-
SimonRemoteException
protected void closeRawChannel(org.apache.mina.core.session.IoSession session, int channelToken) throws SimonRemoteException
session
- the related IoSessionchannelToken
- the related channel token
SimonRemoteException
protected PingWatchdog getPingWatchdog()
protected java.util.List<ClosedListener> getClosedListenerList(java.lang.String remoteObjectName)
remoteObjectName
- the remote objects name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |