gr.uoa.di.madgik.commons.channel.proxy.tcp
Class OutletProtocol

java.lang.Object
  extended by java.lang.Thread
      extended by gr.uoa.di.madgik.commons.channel.proxy.tcp.OutletProtocol
All Implemented Interfaces:
java.lang.Runnable, java.util.Observer

public class OutletProtocol
extends java.lang.Thread
implements java.util.Observer

This class implements the synchronization protocol for the outlet nozzle sides of a channel.

Author:
gpapanikos

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
OutletProtocol(java.lang.Object synchThreadStart, java.net.Socket clientSock, java.lang.String NozzleID, java.lang.String ChannelID, ChannelState State)
          Instantiates a new outlet protocol.
 
Method Summary
 void Dispose()
          Disposes the protocol state and unregisters from events
 java.lang.Boolean HasConnected()
          Checks if the outlet is connected to the inlet channel
 void run()
           
 java.lang.Boolean StillConnected()
          Checks if the outlet is still connected to the inlet channel
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OutletProtocol

public OutletProtocol(java.lang.Object synchThreadStart,
                      java.net.Socket clientSock,
                      java.lang.String NozzleID,
                      java.lang.String ChannelID,
                      ChannelState State)
Instantiates a new outlet protocol. The instance is set as a daemon thread and is started

Parameters:
synchThreadStart - the object the client should wait on until the thread is started and a notify is emitted
clientSock - the socket the protocol should write and read synchronization info
NozzleID - the id of the nozzle this protocol is acting on behalf of
ChannelID - the id of the channel the nozzle is interested in
State - the state where to emit incoming events and register for outgoing events
Method Detail

Dispose

public void Dispose()
Disposes the protocol state and unregisters from events


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

HasConnected

public java.lang.Boolean HasConnected()
Checks if the outlet is connected to the inlet channel

Returns:
whether or not the outlet is connected to the inlet channel

StillConnected

public java.lang.Boolean StillConnected()
Checks if the outlet is still connected to the inlet channel

Returns:
whether or not the outlet is still connected to the inlet channel

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer