ecologylab.services.distributed.server
Interface NIOServerFrontend

All Superinterfaces:
java.lang.Runnable, StartAndStoppable
All Known Implementing Classes:
DoubleThreadedAuthNIOServer, DoubleThreadedNIOServer, HttpGetServer, HTTPPostServer, KmlServer, NIOLoggingServer, NIOServerBase

public interface NIOServerFrontend
extends StartAndStoppable

An interface indicating necessary functionality for a server so that it can properly service ContextManagers.

Author:
Zachary O. Toups (toupsz@cs.tamu.edu)

Method Summary
 AbstractClientManager invalidate(java.lang.Object token, boolean permanent)
          Performs any internal actions that should be taken whenever a client is disconnected.
 void processRead(java.lang.Object token, NIOServerBackend base, java.nio.channels.SelectionKey sk, java.nio.ByteBuffer bs, int bytesRead)
           
 boolean restoreContextManagerFromSessionId(java.lang.Object oldId, AbstractClientManager newContextManager)
          Attempts to switch the ContextManager for a SocketChannel.
 
Methods inherited from interface ecologylab.generic.StartAndStoppable
start, stop
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

processRead

void processRead(java.lang.Object token,
                 NIOServerBackend base,
                 java.nio.channels.SelectionKey sk,
                 java.nio.ByteBuffer bs,
                 int bytesRead)
                 throws BadClientException
Parameters:
base -
sc -
bs -
bytesRead -
Throws:
BadClientException

invalidate

AbstractClientManager invalidate(java.lang.Object token,
                                 boolean permanent)
Performs any internal actions that should be taken whenever a client is disconnected.

Parameters:
token -
base -
sc -
permanent - - indicates whether the NIOServerFrontend should destroy the context manager object associated with the given connection.
Returns:
the ContextManager object associated with sc that has been removed from the system.

restoreContextManagerFromSessionId

boolean restoreContextManagerFromSessionId(java.lang.Object oldId,
                                           AbstractClientManager newContextManager)
Attempts to switch the ContextManager for a SocketChannel. oldId indicates the session id that was used for the connection previously (in order to find the correct ContextManager) and newContextManager is the recently-created (and now, no longer necessary) ContextManager for the connection.

Parameters:
oldId -
newContextManager -
Returns:
true if the restore was successful, false if it was not.