com.javageeks.gjas.services
Class RemoteStorageService

java.lang.Object
  |
  +--com.javageeks.gjas.services.ThreadedServer
        |
        +--com.javageeks.gjas.services.SocketServer
              |
              +--com.javageeks.gjas.services.RemoteStorageService
All Implemented Interfaces:
java.io.Serializable, Service

public class RemoteStorageService
extends SocketServer

RemoteStorageService

See Also:
Serialized Form

Fields inherited from class com.javageeks.gjas.services.SocketServer
m_serverSocket, PORT_PROP, TIMEOUT_PROP
 
Fields inherited from class com.javageeks.gjas.services.ThreadedServer
m_paused, m_shouldStop
 
Fields inherited from interface com.javageeks.gjas.Service
PAUSED, PAUSING, RESUMING, RUNNING, STARTING, STOPPED, STOPPING
 
Constructor Summary
RemoteStorageService()
           
 
Method Summary
 void serve(java.net.Socket socket)
          Use this Socket to answer client requests for serialization services.
 
Methods inherited from class com.javageeks.gjas.services.SocketServer
getConfigInfo, getPort, setConfigInfo, setPort, start, stop
 
Methods inherited from class com.javageeks.gjas.services.ThreadedServer
getInstanceID, getState, getThread, isPaused, kill, pause, resume, setRunnable, setState, setThread, shouldStop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteStorageService

public RemoteStorageService()
Method Detail

serve

public void serve(java.net.Socket socket)
           throws java.lang.Exception
Use this Socket to answer client requests for serialization services. This service, in contrast to others, services only one request/response pair, then shuts down. This is deliberate, as ObjectOutputStream and ObjectInputStream do some activity to the target stream (the socket) during their construction; this means that after the client makes its request and quits, the server will get an Exception claiming the socket "unexpectedly" quit.

Note also that order of construction of the streams (the ObjectInput/ObjectOutput streams) is important; because the client's ObjectInputStream is expecting to find header information on the server's ObjectOutputStream, they must be constructed in offsetting pairs. The server builds them in Output-first-Input-second order, so the client must build them in reverse (Input-first-Output-second) order. For this reason, only use RemoteStorageRequest instances to talk to the RemoteStorageService.

Overrides:
serve in class SocketServer