org.mobicents.slee.resource.lab.stack
Class RAFStack

java.lang.Object
  extended by java.lang.Thread
      extended by org.mobicents.slee.resource.lab.stack.RAFStack
All Implemented Interfaces:
java.lang.Runnable

public class RAFStack
extends java.lang.Thread

RAFStack represents the core of the RAFrame resource adaptor. It is a simple TCP/IP server socket, listening in a separate Thread on incoming connections. Listening is terminated every 1000ms to react on incoming "shutdown" commands.
The socket connection starts on incoming connections a separate Thread of type com.maretzke.raframe.stack.RAStackThread which receives byte[] information (max. 2kb). The received information of any kind is then published to the registered listeners. This information is distributed as String.
The intention of the RAFStack is not to be very efficient or effective - it is implemented to fulfill the requirements of a simple to understand resource adaptor stack implementation which almost everybody is familiar with and it does not cost too much time to understand the message flows.

Author:
Michael Maretzke

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
RAFStack(int port, java.lang.String remotehost, int remoteport)
          Create an instance of RAFStack.
 
Method Summary
 void addListener(RAFStackListener listener)
           
 void run()
           
 void send(java.lang.String message)
          Send a string message to a TCP/IP socket.
 void shutdown()
          This method sets the flag to shut down the stack.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RAFStack

public RAFStack(int port,
                java.lang.String remotehost,
                int remoteport)
         throws java.io.IOException
Create an instance of RAFStack.

Parameters:
port - the port number to listen on
remotehost - the remotehost name the stack sends information to
remoteport - the remotehost's port the stack sends information to
Throws:
java.io.IOException
Method Detail

addListener

public void addListener(RAFStackListener listener)

run

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

shutdown

public void shutdown()
This method sets the flag to shut down the stack. The stack will shut down in less than 1000ms.


send

public void send(java.lang.String message)
Send a string message to a TCP/IP socket. The information is transported as a byte[] array.

Parameters:
message - the message to transport to the listening port


Copyright © 2008. All Rights Reserved.