|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.healthmarketscience.rmiio.RemoteStreamServer<StreamServerType,StreamType>
public abstract class RemoteStreamServer<StreamServerType,StreamType>
Common base class for remote stream implementations which handles the basic status of the stream (whether or not it is exported, closed).
| Field Summary | |
|---|---|
protected RemoteStreamMonitor<StreamServerType> |
_monitor
the monitor which is following our progress |
protected static int |
INITIAL_INVALID_SEQUENCE_ID
the initial sequence id for server methods which have not yet been invoked |
protected static int |
INITIAL_VALID_SEQUENCE_ID
the initial sequence id for client code which has not yet invoked any remote methods |
protected static org.apache.commons.logging.Log |
LOG
|
| Constructor Summary | |
|---|---|
RemoteStreamServer(RemoteStreamMonitor<StreamServerType> monitor)
|
|
| Method Summary | |
|---|---|
void |
abort()
Aborts the current transfer without closing this RemoteStreamServer. |
protected void |
checkAborted()
Throws an IOException if the stream has been aborted. |
void |
close()
Forces this stream server to close (if not already closed), will break any outstanding client interactions. |
protected abstract void |
closeImpl(boolean transferSuccess)
Closes (possibly flushes) the underlying streams and cleans up any resources. |
StreamType |
export()
Convenience method which exports this object for use using the exporter retrieved from RemoteStreamExporter.getInstance(). |
void |
exported(RemoteStreamExporter exporter)
Indicates to this object that it was exported remotely. |
protected void |
finish(boolean remoteClose,
boolean transferSuccess)
Cleans up after this stream. |
protected abstract StreamServerType |
getAsSub()
Returns a handle to this object as a subclass instance. |
protected abstract Object |
getLock()
Returns a handle to the object used to lock the underlying stream operations for this remote stream. |
abstract Class<StreamType> |
getRemoteClass()
|
boolean |
isClosed()
|
void |
unreferenced()
|
protected Object |
writeReplace()
Manages serialization for all remote stream instances by returning the result of a call to export() on this instance as a Serializable
replacement for an instance of this class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log LOG
protected static final int INITIAL_INVALID_SEQUENCE_ID
protected static final int INITIAL_VALID_SEQUENCE_ID
protected transient RemoteStreamMonitor<StreamServerType> _monitor
| Constructor Detail |
|---|
public RemoteStreamServer(RemoteStreamMonitor<StreamServerType> monitor)
| Method Detail |
|---|
public StreamType export()
throws RemoteException
RemoteStreamExporter.getInstance().
RemoteException
public void exported(RemoteStreamExporter exporter)
throws RemoteException
exporter - the exporter that exported this object
RemoteExceptionpublic void unreferenced()
unreferenced in interface Unreferencedpublic final boolean isClosed()
true iff this stream server has been closed (one way
or another), false otherwise.public final void close()
unreferenced method if the server object must live beyond
the creation method call).
close in interface Closeable
protected final void finish(boolean remoteClose,
boolean transferSuccess)
throws IOException
remoteClose - indicates whether this was a remote close() call
or a local cleanup close after a failed transfer.transferSuccess - true iff all data was successfully
transferred, false otherwise
IOException
public final void abort()
throws IOException
IOException
protected final void checkAborted()
throws IOException
close method.
IOException
protected final Object writeReplace()
throws ObjectStreamException
export() on this instance as a Serializable
replacement for an instance of this class. While generally the developer
should be managing the call to export, implementing this method in a
useful way makes the simple things simple (passing a reference to a
server implementation in a remote method call will "do the right thing",
replacing the actual reference to this instance with a reference to an
automagically generated remote reference to this server instance).
NotSerializableException - if the export attempt fails
ObjectStreamException
protected abstract void closeImpl(boolean transferSuccess)
throws IOException
transferSuccess - true iff all data was successfully
transferred, false otherwise
IOExceptionprotected abstract Object getLock()
public abstract Class<StreamType> getRemoteClass()
protected abstract StreamServerType getAsSub()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||