public abstract class AbstractServer extends AbstractGenericEngine implements java.beans.PropertyChangeListener
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractServer.ServerReply |
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.LinkedBlockingQueue<SocketWrapper> |
clientQueue |
protected boolean |
isCallerAJavaApplication |
finalTask, logger, queue, tasksDone
Modifier | Constructor and Description |
---|---|
protected |
AbstractServer(ServerConfiguration configuration,
boolean isCallerAJavaApplication)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
protected void |
closeAndRestartTheseThreads(java.util.Collection<ClientThread> connectionsToBeClosed) |
protected abstract ClientThread |
createClientThread(AbstractServer server,
int id) |
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue) |
protected void |
firstTasksToDo()
This method sets the first tasks to execute when the engine starts.
|
protected java.util.List<ClientThread> |
getClientThreads()
This method returns the vector of client threads.
|
protected ServerConfiguration |
getConfiguration() |
protected SocketWrapper |
getWaitingClients()
This method waits until the head of the queue is non null and returns the socket.
|
protected void |
listenToClients()
This method starts the worker thread, which listens to the clients in the queue.
|
void |
propertyChange(java.beans.PropertyChangeEvent evt) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
requestShutdown()
This method requests the Engine to shut down.
|
protected void |
startReceiverThread()
This method starts the callReceiver thread that handles the call from the clients.
|
addTask, addTasks, cancelRunningTask, decideWhatToDoInCaseOfFailure, getSettingMemory, lockEngine, lockEngine, setSettingMemory, shutdown, startApplication, unlockEngine
protected final java.util.concurrent.LinkedBlockingQueue<SocketWrapper> clientQueue
protected final boolean isCallerAJavaApplication
protected AbstractServer(ServerConfiguration configuration, boolean isCallerAJavaApplication) throws java.lang.Exception
configuration
- a ServerConfiguration instance that defines the number of threads, the reference path and the filename of the exception rulesisCallerAJavaApplication
- true if the client is a Java appjava.lang.Exception
protected abstract ClientThread createClientThread(AbstractServer server, int id)
protected SocketWrapper getWaitingClients() throws java.lang.InterruptedException
java.lang.InterruptedException
protected void listenToClients()
protected void startReceiverThread() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
protected ServerConfiguration getConfiguration()
protected java.util.List<ClientThread> getClientThreads()
protected void closeAndRestartTheseThreads(java.util.Collection<ClientThread> connectionsToBeClosed)
protected void firstTasksToDo()
AbstractGenericEngine
firstTasksToDo
in class AbstractGenericEngine
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
public void requestShutdown()
AbstractGenericEngine
requestShutdown
in class AbstractGenericEngine