|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.abstracthorizon.danube.service.Service
org.abstracthorizon.danube.service.server.ServerService
org.abstracthorizon.danube.service.server.MultiThreadServerService
org.abstracthorizon.danube.service.server.MultiThreadServerSocketService
public class MultiThreadServerSocketService
This is server service that is implemented using sockets. This service accepts connections from a
server socket, creates new ConnectionHandlerThread objects
and executes them in a given thread by Executor.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.abstracthorizon.danube.service.server.MultiThreadServerService |
|---|
MultiThreadServerService.ConnectionHandlerThread |
| Field Summary | |
|---|---|
protected int |
newSocketTimeout
New socket's timeout |
protected ServerSocket |
serverSocket
Reference to the server socket |
protected int |
serverSocketTimeout
Initial socket timeout |
| Fields inherited from class org.abstracthorizon.danube.service.server.MultiThreadServerService |
|---|
activeConnections, executor, graceFinishPeriod |
| Fields inherited from class org.abstracthorizon.danube.service.server.ServerService |
|---|
connectionHandler, socketAddress |
| Fields inherited from class org.abstracthorizon.danube.service.Service |
|---|
DESTROYED, INITIALIZED, listeners, logger, name, NOT_INITIALIZED, RUNNING, SERVICE_STATE_NAMES, STARTED, STOPPED, STOPPING, stopService |
| Constructor Summary | |
|---|---|
MultiThreadServerSocketService()
Default constructor |
|
| Method Summary | |
|---|---|
void |
create()
Creates the socket |
protected void |
createServerSocket()
Creates server socket |
protected Connection |
createSocketConnection(Socket socket)
Creates new socket connection |
void |
destroy()
Closes the server socket |
protected void |
destroyServerSocket()
Closes server socket |
int |
getNewSocketTimeout()
Returns new socket timeout |
int |
getServerSocketTimeout()
Returns initial socket timeout |
protected void |
processConnection(Socket socket)
Creates server connection and new instance of ConnectionHandlerThread to process
socket under the given executor |
protected void |
processConnections()
This method processes connections |
void |
setNewSocketTimeout(int socketTimeout)
Sets new socket timeout |
void |
setServerSocketTimeout(int socketTimeout)
Sets server socket timeout |
| Methods inherited from class org.abstracthorizon.danube.service.server.MultiThreadServerService |
|---|
getActiveConnections, getExecutor, getGraceFinishPeriod, getNumberOfActiveConnections, run, setExecutor, setGraceFinishPeriod, start, stop |
| Methods inherited from class org.abstracthorizon.danube.service.server.ServerService |
|---|
getAddress, getConnectionHandler, getPort, getSocketAddress, setAddress, setConnectionHandler, setPort, setSocketAddress |
| Methods inherited from class org.abstracthorizon.danube.service.Service |
|---|
addListener, changeState, getName, getState, getStateName, removeListener, setName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int serverSocketTimeout
protected int newSocketTimeout
protected ServerSocket serverSocket
| Constructor Detail |
|---|
public MultiThreadServerSocketService()
| Method Detail |
|---|
public int getServerSocketTimeout()
public void setServerSocketTimeout(int socketTimeout)
socketTimeout - initial socket timeoutpublic int getNewSocketTimeout()
public void setNewSocketTimeout(int socketTimeout)
socketTimeout - new socket timeout
public void create()
throws ServiceException
create in class ServiceServiceException
public void destroy()
throws ServiceException
destroy in class ServiceServiceExceptionprotected void processConnections()
processConnections in class MultiThreadServerService
protected void createServerSocket()
throws ServiceException
ServiceException
protected void destroyServerSocket()
throws ServiceException
ServiceExceptionprotected void processConnection(Socket socket)
ConnectionHandlerThread to process
socket under the given executor
socket - socket
protected Connection createSocketConnection(Socket socket)
throws IOException
socket - socket
IOException
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||