pyrasun.eio.services.bytearray
Class ByteArrayServerService

java.lang.Object
  extended bypyrasun.eio.services.AbstractEmberService
      extended bypyrasun.eio.services.bytearray.ByteArrayServerService
All Implemented Interfaces:
EIOAcceptWorkerFactory.EIOAcceptWorkerCallback, EIOEndpointFactory, EmberService, EndpointEventListener

public class ByteArrayServerService
extends AbstractEmberService
implements EndpointEventListener, EIOAcceptWorkerFactory.EIOAcceptWorkerCallback, EIOEndpointFactory

The ObjectServerService is a simple service for facilitating sending objects around between processes.


Field Summary
 
Fields inherited from interface pyrasun.eio.services.EmberService
RUNNING, STOPPED
 
Constructor Summary
ByteArrayServerService(EIOGlobalContext context, EIOPoolingStrategy acceptStrategy, EIOPoolingStrategy ioStrategy, java.lang.String host, int port)
           
 
Method Summary
 ReadWriteEndpoint createEndpoint(EndpointCoordinator coord, java.nio.channels.SocketChannel channel)
           
 void endpointClosed(Endpoint endpoint, EIOReasonCode reason, java.lang.String msg, java.lang.Throwable t, java.lang.Object context)
          A callback indicating that the specified endpoint was closed.
 void newEndpoint(ReadWriteEndpoint endpoint)
           
 void reportReadError(Endpoint endpoint, EIOReasonCode why, java.lang.String msg, java.lang.Throwable t, java.lang.Object context)
          Reports that a non-fatal error occured while reading from this endpoint.
 void reportWriteError(Endpoint endpoint, EIOReasonCode why, java.lang.String msg, java.lang.Throwable t, java.lang.Object context)
          Reports that a non-fatal error occured while writing to this endpoint.
 void setListener(ByteArrayServerListener listener)
           
 void start()
          Start the service.
 void stop()
          Stop the service.
 
Methods inherited from class pyrasun.eio.services.AbstractEmberService
failureOK, getController, getName, getState, isStoppable, setController
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayServerService

public ByteArrayServerService(EIOGlobalContext context,
                              EIOPoolingStrategy acceptStrategy,
                              EIOPoolingStrategy ioStrategy,
                              java.lang.String host,
                              int port)
                       throws java.io.IOException
Method Detail

start

public void start()
           throws EmberServiceException
Start the service.

Specified by:
start in interface EmberService
Specified by:
start in class AbstractEmberService
Throws:
ServiceException - if the service fails to start, or is already running
EmberServiceException

stop

public void stop()
          throws EmberServiceException
Stop the service.

Specified by:
stop in interface EmberService
Specified by:
stop in class AbstractEmberService
Throws:
ServiceException - if the service fails to stop, or is already stopped
EmberServiceException

setListener

public void setListener(ByteArrayServerListener listener)

createEndpoint

public ReadWriteEndpoint createEndpoint(EndpointCoordinator coord,
                                        java.nio.channels.SocketChannel channel)
Specified by:
createEndpoint in interface EIOEndpointFactory

newEndpoint

public void newEndpoint(ReadWriteEndpoint endpoint)
Specified by:
newEndpoint in interface EIOAcceptWorkerFactory.EIOAcceptWorkerCallback

endpointClosed

public void endpointClosed(Endpoint endpoint,
                           EIOReasonCode reason,
                           java.lang.String msg,
                           java.lang.Throwable t,
                           java.lang.Object context)
Description copied from interface: EndpointEventListener
A callback indicating that the specified endpoint was closed.

Specified by:
endpointClosed in interface EndpointEventListener
Parameters:
endpoint - The endpoint that was closed
reason - Indicator as to why the endpoint was closed
msg - Semi-friendly text explaining in more detail why it was closed. May be null!
t - Exception that caused the close. May be null if an exception was not the cause
context - An object that indicates the context in which the close happened. Usually null, but app code may override with its own meaning

reportReadError

public void reportReadError(Endpoint endpoint,
                            EIOReasonCode why,
                            java.lang.String msg,
                            java.lang.Throwable t,
                            java.lang.Object context)
Description copied from interface: EndpointEventListener
Reports that a non-fatal error occured while reading from this endpoint.

Specified by:
reportReadError in interface EndpointEventListener

reportWriteError

public void reportWriteError(Endpoint endpoint,
                             EIOReasonCode why,
                             java.lang.String msg,
                             java.lang.Throwable t,
                             java.lang.Object context)
Description copied from interface: EndpointEventListener
Reports that a non-fatal error occured while writing to this endpoint.

Specified by:
reportWriteError in interface EndpointEventListener


Pyrasun EmberIO