com.healthmarketscience.rmiio.exporter
Class DefaultRemoteStreamExporter

java.lang.Object
  extended by com.healthmarketscience.rmiio.exporter.RemoteStreamExporter
      extended by com.healthmarketscience.rmiio.exporter.DefaultRemoteStreamExporter

public class DefaultRemoteStreamExporter
extends RemoteStreamExporter

Default concrete implementation of RemoteStreamExporter which exports the object for use with with standard RMI, via UnicastRemoteObject.

The default constructor will use a port configured by the system property PORT_PROPERTY if one is found, otherwise ANY_PORT will be used.

Author:
James Ahlborn

Field Summary
static int ANY_PORT
          constant indicating that export can use any port
static String PORT_PROPERTY
          system property used to determine the port to use for the default constructor.
 
Fields inherited from class com.healthmarketscience.rmiio.exporter.RemoteStreamExporter
DEFAULT_EXPORTER_CLASS_NAME, EXPORTER_PROPERTY, LOG
 
Constructor Summary
DefaultRemoteStreamExporter()
           
DefaultRemoteStreamExporter(int port)
           
 
Method Summary
protected  Object exportImpl(RemoteStreamServer<?,?> server)
          Called by RemoteStreamExporter.export(StreamServerType) to do the actual export work for the relevant RPC framework.
 int getPort()
           
protected  void unexportImpl(RemoteStreamServer<?,?> server)
          Called by RemoteStreamExporter.unexport(com.healthmarketscience.rmiio.RemoteStreamServer) to do the actual unexport work for the relevant RPC framework.
 
Methods inherited from class com.healthmarketscience.rmiio.exporter.RemoteStreamExporter
export, getInstance, unexport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_PORT

public static final int ANY_PORT
constant indicating that export can use any port

See Also:
Constant Field Values

PORT_PROPERTY

public static final String PORT_PROPERTY
system property used to determine the port to use for the default constructor. if not given, ANY_PORT is used.

See Also:
Constant Field Values
Constructor Detail

DefaultRemoteStreamExporter

public DefaultRemoteStreamExporter()

DefaultRemoteStreamExporter

public DefaultRemoteStreamExporter(int port)
Method Detail

getPort

public int getPort()

exportImpl

protected Object exportImpl(RemoteStreamServer<?,?> server)
                     throws RemoteException
Description copied from class: RemoteStreamExporter
Called by RemoteStreamExporter.export(StreamServerType) to do the actual export work for the relevant RPC framework. This method will be called synchronized on the given stream instance, so it will not overlap an RemoteStreamExporter.unexport(com.healthmarketscience.rmiio.RemoteStreamServer) call for the same instance.

Note, RemoteStreamServer implements Unreferenced, which is an rmi interface used to clean up servers which have lost their clients. RPC frameworks which export remote streams should attempt to handle abnormal client termination, and are encouraged to make use of the Unreferenced interface to shutdown an orphaned stream server.

Specified by:
exportImpl in class RemoteStreamExporter
Returns:
the remote stub, which should be an instance of the remote interface of this server
Throws:
RemoteException - if the stream instance could not be exported

unexportImpl

protected void unexportImpl(RemoteStreamServer<?,?> server)
                     throws Exception
Description copied from class: RemoteStreamExporter
Called by RemoteStreamExporter.unexport(com.healthmarketscience.rmiio.RemoteStreamServer) to do the actual unexport work for the relevant RPC framework. This method will be called synchronized on the given stream instance, so it will not overlap an RemoteStreamExporter.export(StreamServerType) call for the same instance. This method call is allowed break existing connections to this stream instance. Any exceptions thrown will be logged, but otherwise ignored.

Specified by:
unexportImpl in class RemoteStreamExporter
Throws:
Exception - if the unexport failed


Copyright © 2006–2016 Health Market Science. All rights reserved.