amber.server.manager.connection
Class LoginThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--amber.server.manager.connection.LoginThread
All Implemented Interfaces:
ConnectionReceiver, java.lang.Runnable

public class LoginThread
extends java.lang.Thread
implements ConnectionReceiver

Thread to deal with the initial reception of login packets. This thread handles the incoming packets and initiates the ApplicationHandlers.

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
ConnectionManager, ListenerThread

Field Summary
protected  java.security.SecureRandom random
          Secure random number generator used if the link is secure.
protected  Mutex waitForConnection
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LoginThread(ConnectionManager parent, int type, int number)
          Construct the thread, with it's parent class so it may pass back messages.
 
Method Summary
 void addConnection(java.net.Socket socket, int type)
          This function adds a new socket connection to the thread for processing.
 long getLastActiveTime()
          This indicates the last time that the thread was active.
 int getPendingConnectionCount()
          This function returns the count of the number of connections the thread is currently handling.
 int getType()
          Returns the type of listener this is.
 void run()
          Main implementation function.
 void setType(int type)
          Sets the type of listener this is.
 void terminate()
          This function causes the flag to be set terminating this thread.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

waitForConnection

protected Mutex waitForConnection

random

protected java.security.SecureRandom random
Secure random number generator used if the link is secure.
Constructor Detail

LoginThread

public LoginThread(ConnectionManager parent,
                   int type,
                   int number)
Construct the thread, with it's parent class so it may pass back messages.
Parameters:
parent - ConnectionManager parent object.
type - int containing the type of listener this is. This matches the constants in this class.
certificate - RSAKey containing the encryption certificate. This is required for secure connections.
number - int thread number, used for logging purposes.
Method Detail

addConnection

public void addConnection(java.net.Socket socket,
                          int type)
This function adds a new socket connection to the thread for processing. This function will also waken the thread if it is in a suspended state.
Specified by:
addConnection in interface ConnectionReceiver
Parameters:
socket - Socket which is the incoming connection.
type - int defining the type of connection received. This value corresponds to the constants defined in Listener.
See Also:
Listener

terminate

public void terminate()
This function causes the flag to be set terminating this thread.

getPendingConnectionCount

public int getPendingConnectionCount()
This function returns the count of the number of connections the thread is currently handling.
Returns:
int number of connections pending.

run

public void run()
Main implementation function. It takes the received connections and calls the ConnectionManager to handle the incoming connection.
Overrides:
run in class java.lang.Thread

getLastActiveTime

public long getLastActiveTime()
This indicates the last time that the thread was active.

setType

public void setType(int type)
Sets the type of listener this is.
Parameters:
type - int type of listener. This must match the type constants specified in the ListenerThread class.

getType

public int getType()
Returns the type of listener this is.
Returns:
int type of listener. This must match the type constants specified in the ListenerThread class.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.