|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jason.core.AbstractService | +--jason.core.ThreadableService | +--jason.core.TaskableService | +--jason.core.SocketService
Created Sat Feb 16 18:50:38 2002
This service is for all socket service (like HTTP server). It simplify the socker server management by a thread pooling system.
User must implement the getTaskForSocket
method
AbstractService
,
Serialized FormField Summary | |
protected int |
port
|
protected java.net.ServerSocket |
serverSocket
|
protected boolean |
traceRequest
|
Fields inherited from class jason.core.ThreadableService |
activeThread |
Fields inherited from class jason.core.AbstractService |
INITIALIZED, name, NOSTATE, serviceContext, STARTED, STOPPED |
Fields inherited from interface jason.core.Service |
ERROR_MESSAGE, INFORMATION_MESSAGE, VERBOSE_MESSAGE, WARNING_MESSAGE |
Constructor Summary | |
SocketService()
Run this service in a thread mode |
Method Summary | |
protected void |
beforeRun()
This code is called in the current thread once before the run loop. |
protected void |
fireConflictDetected()
A port conflict has been detected |
protected void |
fireSocketAccept(java.net.Socket host)
Manage a connection on the port |
int |
getSocketTimeout()
|
protected abstract Task |
getTaskForSocket(java.net.Socket host)
|
protected void |
notifyBadPort()
We find another service on the port, switch to the load Balancing mode |
void |
notifyData(java.lang.String key,
java.lang.Object value)
Test for the port value in the common service data space |
protected void |
notifyInitReady()
Search for the port property |
protected void |
run()
Start the service waiting for a user request or another service request for loadbalancing request |
void |
setBacklog(int backlog)
Reset the queue size for the server socket object. |
void |
setSocketTimeout(int socketTimeout)
This method will reset the timeout for socket. |
void |
setTraceRequest(boolean trace)
|
void |
start()
Start the service. |
Methods inherited from class jason.core.TaskableService |
notifyTask |
Methods inherited from class jason.core.ThreadableService |
actionForStart, enableServiceForThread, getThreadLoopDelay, isThreadLoopMode, isThreadStarted, isWaiting, notifyThreadRunning, runThread, setPriority, setThreadLoopDelay, setThreadLoopMode, threadNotify, threadWait |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int port
protected boolean traceRequest
protected java.net.ServerSocket serverSocket
Constructor Detail |
public SocketService()
Method Detail |
public void setTraceRequest(boolean trace)
protected void notifyInitReady()
notifyInitReady
in class AbstractService
public void start()
AbstractService
run
method
start
in interface Service
start
in class AbstractService
public void setBacklog(int backlog)
protected void beforeRun()
public void setSocketTimeout(int socketTimeout)
socketTimeout
- time out in mspublic int getSocketTimeout()
protected void run()
run
in class AbstractService
protected void notifyBadPort()
protected void fireSocketAccept(java.net.Socket host)
protected abstract Task getTaskForSocket(java.net.Socket host) throws ServiceException
ServiceException
public void notifyData(java.lang.String key, java.lang.Object value)
notifyData
in interface ServiceDataListener
notifyData
in class AbstractService
protected void fireConflictDetected()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |