public class Server extends java.lang.Thread implements Constants
Remote
objects and
listens for connections from remote references. It also contains
static methods that the Ref
class uses to make remote
invocations.DGC_PING, METHOD_CALL, METHOD_ERROR, METHOD_RESULT, SYSTEM_ERROR
Constructor and Description |
---|
Server()
Constructs a Server instance that will bind to any available
port and does not have any
Interceptor s. |
Server(ClientInterceptor clint,
Interceptor srvint)
Constructs a Server instance that will bind to any available
port and use the given client and server
Interceptor s. |
Server(int port,
ClientInterceptor clint,
Interceptor srvint)
Construcst a Server instance with the specified port, client,
and server
Interceptor s. |
Modifier and Type | Method and Description |
---|---|
void |
export(java.rmi.Remote object)
Exports the given
Remote object. |
java.lang.ClassLoader |
getLoader(java.rmi.server.ObjID oid)
Return the
ClassLoader used for deserializing arguments
to methods of the exported object mapped to the given oid or
null if there is none. |
java.rmi.Remote |
getObject(java.rmi.server.ObjID oid)
Return the exported object for the given oid or null if there
is none.
|
java.rmi.server.ObjID |
getOID(java.rmi.Remote obj)
Return the ObjID for the given
Remote object or null if
there is none. |
static java.util.Collection |
getServers()
Returns all the Server instances for this JVM.
|
java.rmi.server.Skeleton |
getSkel(java.rmi.Remote obj)
Construct and return a
Skeleton for the given Remote object. |
java.rmi.server.RemoteStub |
getStub(java.rmi.Remote obj)
Converts the given
Remote object to a RemoteStub instance. |
void |
run()
Accepts connections and launches Handler threads.
|
boolean |
unexport(java.rmi.server.ObjID oid)
Unexports the
Remote object associated with the given
ObjID if it is being exported by this Server. |
boolean |
unexport(java.rmi.Remote obj)
Unexports the given
Remote object if it is being
exported by this Server. |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public Server(int port, ClientInterceptor clint, Interceptor srvint)
Interceptor
s. If port is zero then any
available port will be chosen.port
- the port for the server to bind toclint
- the client Interceptor
or nullsrvint
- the server Interceptor
or nullpublic Server(ClientInterceptor clint, Interceptor srvint)
Interceptor
s.clint
- the client Interceptor
srvint
- the server Interceptor
public Server()
Interceptor
s.public static java.util.Collection getServers()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public java.rmi.Remote getObject(java.rmi.server.ObjID oid)
oid
- the oid of an exported objectpublic java.rmi.server.ObjID getOID(java.rmi.Remote obj)
Remote
object or null if
there is none.obj
- an exported objectpublic java.lang.ClassLoader getLoader(java.rmi.server.ObjID oid)
ClassLoader
used for deserializing arguments
to methods of the exported object mapped to the given oid or
null if there is none.oid
- the oid of an exported objectpublic java.rmi.server.Skeleton getSkel(java.rmi.Remote obj)
Skeleton
for the given Remote
object.obj
- a Remote
objectSkeleton
for objpublic java.rmi.server.RemoteStub getStub(java.rmi.Remote obj)
Remote
object to a RemoteStub
instance. This may involve nothing if the object is
already a stub, or it may involve search for an appropriate
stub class and constructing an instance of it.obj
- the Remote
objectRemoteStub
for objpublic void export(java.rmi.Remote object) throws java.rmi.server.ExportException
Remote
object.object
- the object to exportjava.rmi.server.ExportException
- when there is an errorpublic boolean unexport(java.rmi.Remote obj)
Remote
object if it is being
exported by this Server.obj
- the object to unexportpublic boolean unexport(java.rmi.server.ObjID oid)
Remote
object associated with the given
ObjID
if it is being exported by this Server.oid
- the ObjID of the Remote
object to be
unexported