Package org.acplt.oncrpc.server
Class OncRpcServerStub
java.lang.Object
org.acplt.oncrpc.server.OncRpcServerStub
- Direct Known Subclasses:
jportmap
The abstract
OncRpcServerStub
class is the base class to
build ONC/RPC-program specific servers upon. This class is typically
only used by jrpcgen generated servers, which provide a particular
set of remote procedures as defined in a x-file.- Version:
- $Revision: 1.2 $ $Date: 2003/08/14 13:47:04 $ $State: Exp $ $Locker: $
- Author:
- Harald Albrecht
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
Encoding to use when deserializing strings ornull
if the system's default encoding should be used.Array containing program and version numbers tuples this server is willing to handle.protected Object
Notification flag for signalling the server to stop processing incomming remote procedure calls and to shut down.Array containing ONC/RPC server transport objects which describe what transports an ONC/RPC server offers for handling ONC/RPC calls. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(OncRpcServerTransport[] transports) Close all transports listed in a set of server transports.Get the character encoding for deserializing strings.void
register
(OncRpcServerTransport[] transports) Register a set of server transports with the local portmapper.void
run()
All inclusive convenience method: register server transports with portmapper, then run the call dispatcher until the server is signalled to shut down, and finally deregister the transports.void
run
(OncRpcServerTransport[] transports) Process incomming remote procedure call requests from all specified transports.void
setCharacterEncoding
(String characterEncoding) Set the character encoding for deserializing strings.void
Notify the RPC server to stop processing of remote procedure call requests as soon as possible.void
unregister
(OncRpcServerTransport[] transports) Unregister a set of server transports from the local portmapper.
-
Field Details
-
transports
Array containing ONC/RPC server transport objects which describe what transports an ONC/RPC server offers for handling ONC/RPC calls. -
info
Array containing program and version numbers tuples this server is willing to handle. -
shutdownSignal
Notification flag for signalling the server to stop processing incomming remote procedure calls and to shut down. -
characterEncoding
Encoding to use when deserializing strings ornull
if the system's default encoding should be used.
-
-
Constructor Details
-
OncRpcServerStub
public OncRpcServerStub()
-
-
Method Details
-
run
All inclusive convenience method: register server transports with portmapper, then run the call dispatcher until the server is signalled to shut down, and finally deregister the transports.- Throws:
OncRpcException
- if the portmapper can not be contacted successfully.IOException
- if a severe network I/O error occurs in the server from which it can not recover (like severe exceptions thrown when waiting for now connections on a server socket).
-
register
Register a set of server transports with the local portmapper.- Parameters:
transports
- Array of server transport objects to register, which will later handle incomming remote procedure call requests.- Throws:
OncRpcException
- if the portmapper could not be contacted successfully.
-
run
Process incomming remote procedure call requests from all specified transports. To end processing and to shut the server down signal theshutdownSignal
object. Note that the thread on whichrun()
is called will ignore any interruptions and will silently swallow them.- Parameters:
transports
- Array of server transport objects for which processing of remote procedure call requests should be done.
-
stopRpcProcessing
public void stopRpcProcessing()Notify the RPC server to stop processing of remote procedure call requests as soon as possible. Note that each transport has its own thread, so processing will not stop before the transports have been closed by calling theclose(org.acplt.oncrpc.server.OncRpcServerTransport[])
method of the server. -
unregister
Unregister a set of server transports from the local portmapper.- Parameters:
transports
- Array of server transport objects to unregister.- Throws:
OncRpcException
- with a reason ofOncRpcException.RPC_FAILED
if the portmapper could not be contacted successfully. Note that it is not considered an error to remove a non-existing entry from the portmapper.
-
close
Close all transports listed in a set of server transports. Only by calling this method processing of remote procedure calls by individual transports can be stopped. This is because every server transport is handled by its own thread.- Parameters:
transports
- Array of server transport objects to close.
-
setCharacterEncoding
Set the character encoding for deserializing strings.- Parameters:
characterEncoding
- the encoding to use for deserializing strings. Ifnull
, the system's default encoding is to be used.
-
getCharacterEncoding
Get the character encoding for deserializing strings.- Returns:
- the encoding currently used for deserializing strings.
If
null
, then the system's default encoding is used.
-