cdev
Class BasicServer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--cdev.BasicServer

public abstract class BasicServer
extends java.lang.Thread
implements TransactionListener, TransactionResponseListener


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BasicServer()
           
 
Method Summary
 void cancel(DeviceTransaction dt)
          Cancel a transaction
 java.util.Enumeration getTransactions()
          Get an enumeration of transactions
 void handleResponse(DeviceTransaction dt)
          Queue a completed transaction for transmission (coming from derived class's process routine)
 int initialize()
           
 int initialize(int port)
          Initialize the server, starting 3 threads: 1 --> listen for connections (new thread for each) 2 --> process queue for inbound messages 3 --> process queue for outbound responses
 void post(DeviceTransaction dt)
          Post a new transaction for processing in server (coming from a client handler).
 void processOutbound()
           
 void registerIOService(IOService s)
          Register an IOService with this Server
 void run()
          Run method accepts new connections and starts a client handler (method supplied in derived class)
 void unregisterIOService(IOService s)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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

BasicServer

public BasicServer()
Method Detail

initialize

public int initialize(int port)
               throws java.io.IOException
Initialize the server, starting 3 threads: 1 --> listen for connections (new thread for each) 2 --> process queue for inbound messages 3 --> process queue for outbound responses

initialize

public int initialize()
               throws java.io.IOException

run

public void run()
Run method accepts new connections and starts a client handler (method supplied in derived class)
Overrides:
run in class java.lang.Thread

post

public void post(DeviceTransaction dt)
Post a new transaction for processing in server (coming from a client handler).
Specified by:
post in interface TransactionListener

cancel

public void cancel(DeviceTransaction dt)
Cancel a transaction
Specified by:
cancel in interface TransactionListener

getTransactions

public java.util.Enumeration getTransactions()
Get an enumeration of transactions
Specified by:
getTransactions in interface TransactionListener

handleResponse

public void handleResponse(DeviceTransaction dt)
Queue a completed transaction for transmission (coming from derived class's process routine)
Specified by:
handleResponse in interface TransactionResponseListener

processOutbound

public void processOutbound()

registerIOService

public void registerIOService(IOService s)
Register an IOService with this Server
Specified by:
registerIOService in interface TransactionListener

unregisterIOService

public void unregisterIOService(IOService s)
Specified by:
unregisterIOService in interface TransactionListener