public static class RMIRegistry.Builder
extends java.lang.Object
RMIRegistry
. A new instance of this class can be returned
by the RMIRegistry.builder()
static method. A new instance of this
class wraps all the defaults for RMIRegistry
and allows to modify
them. When the configuration has been terminated, a new RMIRegistry
instance can be obtained by the build()
method.build()
method to generate new instances of
RMIRegistry
. Each call to the build()
method
does not reset the builder instance to its default state.Modifier and Type | Method and Description |
---|---|
RMIRegistry.Builder |
addCodebase(java.lang.String url)
Utility method to add a codebase at building time.
|
RMIRegistry.Builder |
addCodebase(java.net.URL url)
Utility method to add a codebase at building time.
|
RMIRegistry.Builder |
addCodebases(java.lang.Iterable<java.net.URL> urls)
Utility method to add code-bases at building time.
|
RMIRegistry.Builder |
addCodebases(java.lang.String... urls)
Utility method to add code-bases at building time.
|
RMIRegistry.Builder |
addCodebases(java.net.URL... urls)
Utility method to add code-bases at building time.
|
RMIRegistry |
build()
Builds the
RMIRegistry instance. |
RMIRegistry.Builder |
clearCodebasesSet()
Remove all the codebases added to this builder.
|
RMIRegistry.Builder |
replaceRemoteException(java.lang.Class<java.lang.Exception> exceptionClass)
Let the stubs to throw the specified exception alternatively to
RemoteException on communication errors. |
RMIRegistry.Builder |
setAuthenticator(RMIAuthenticator rmiAuthenticator)
Set an
RMIAuthenticator object that intercept authentication and
authorization requests from remote machines. |
RMIRegistry.Builder |
setAutomaticReferencingEnabled(boolean automaticReferencingEnabled)
Enables or disables the automatic referencing which is the mechanism that
replace all the remote objects with its stubs when they are transmitted over
RMI streams.
|
RMIRegistry.Builder |
setClassLoaderFactory(ClassLoaderFactory classLoaderFactory)
Sets the class loader factory used by this registry to decode remote classes
when code mobility is enabled.
|
RMIRegistry.Builder |
setCodeDownloadingEnabled(boolean codeDownloadingEnabled)
Enable dynamic code downloading.
|
RMIRegistry.Builder |
setHandlerFaultMaxLife(long handlerFaultMaxLife)
Sets the maximum life of each
handler . |
RMIRegistry.Builder |
setLatencyTime(int latencyTime)
Sets an estimate of the TCP connection latency time.
|
RMIRegistry.Builder |
setLeaseTime(int leaseTime)
Sets the lease timeout after that the distributed garbage collection
mechanism will remove a non-named object from the registry.
|
RMIRegistry.Builder |
setMultiConnectionMode(boolean multiConnectionMode)
Enables or disables multi-connection mode.
|
RMIRegistry.Builder |
setProtocolEndpointFactory(ProtocolEndpointFactory protocolEndpointFactory)
Sets the
ProtocolEndpointFactory instance to use in the registry to
build. |
RMIRegistry.Builder |
setSkeletonInvocationCacheSize(int skeletonInvocationCacheSize)
Sets the cache size of invocations results for each skeleton.
|
RMIRegistry.Builder |
setSocketFactories(javax.net.SocketFactory socketFactory,
javax.net.ServerSocketFactory serverSocketFactory)
Sets the socket factories that the registry will use.
|
RMIRegistry.Builder |
setStateConsistencyOnFaultEnabled(boolean stateConsistencyOnFaultEnabled)
When enabled, this flag ensures that, after a connection fault, a stub will
be reconnected with the same remote object instance that existed before the
fault.
|
RMIRegistry.Builder |
suppressAllInvocationFaults(boolean suppressAllInvocationFaults)
Enables or disables the suppression of all remote invocation faults.
|
public RMIRegistry.Builder replaceRemoteException(java.lang.Class<java.lang.Exception> exceptionClass)
RemoteException
on communication errors.exceptionClass
- the alternative exception class or null if the
RemoteException
must not be replaced.public RMIRegistry.Builder suppressAllInvocationFaults(boolean suppressAllInvocationFaults)
remote exceptions
, so the remote methods can be
declared without throwing these exceptions. This is useful when turning an
existing code into a distributed one. 0
for all numerical primitive (such
as int) and non-primitive (such as Integer
) types, false
for the boolean type and null
for object types.suppressAllInvocationFaults
- true to suppress all invocation faults on
the stubspublic RMIRegistry.Builder setMultiConnectionMode(boolean multiConnectionMode)
multiConnectionMode
- true to enable, false to disablepublic RMIRegistry.Builder setStateConsistencyOnFaultEnabled(boolean stateConsistencyOnFaultEnabled)
stateConsistencyOnFaultEnabled
- true to enable state consistency
guarantee on connection faultpublic RMIRegistry.Builder setSkeletonInvocationCacheSize(int skeletonInvocationCacheSize)
skeletonInvocationCacheSize
- the max number of invocations return
values to store in the cache of the
skeletonpublic RMIRegistry.Builder setAutomaticReferencingEnabled(boolean automaticReferencingEnabled)
lease time
.automaticReferencingEnabled
- set to true to enable automatic
referencig, false otherwise.public RMIRegistry.Builder setLeaseTime(int leaseTime)
leaseTime
- the lease timeout value in millisecondspublic RMIRegistry.Builder setLatencyTime(int latencyTime)
latencyTime
- a time in millisecondspublic RMIRegistry.Builder setAuthenticator(RMIAuthenticator rmiAuthenticator)
RMIAuthenticator
object that intercept authentication and
authorization requests from remote machines.
Default: null (no RMIAuthenticator
)rmiAuthenticator
- the RMIAuthenticator
instance to usepublic RMIRegistry.Builder setSocketFactories(javax.net.SocketFactory socketFactory, javax.net.ServerSocketFactory serverSocketFactory)
socketFactory
- the SocketFactory
instance to use to build
client socketsserverSocketFactory
- the ServerSocketFactory
instance to use to
build the listener server socketpublic RMIRegistry.Builder setProtocolEndpointFactory(ProtocolEndpointFactory protocolEndpointFactory)
ProtocolEndpointFactory
instance to use in the registry to
build. protocolEndpointFactory
- the ProtocolEndpointFactory
instance
that gives the ProtocolEndpoint
instance in which the underlying communication
streams will be wrapped inpublic RMIRegistry.Builder setCodeDownloadingEnabled(boolean codeDownloadingEnabled)
codeDownloadingEnabled
- true if the dynamic code downloading must be
enabled, false otherwisepublic RMIRegistry.Builder setClassLoaderFactory(ClassLoaderFactory classLoaderFactory)
URLClassLoaderFactory
)classLoaderFactory
- the factory to usepublic RMIRegistry.Builder addCodebases(java.lang.Iterable<java.net.URL> urls)
urls
- the URLs of the code-basesaddCodebase(URL)
public RMIRegistry.Builder addCodebase(java.net.URL url)
url
- the url to the codebaseaddCodebase(URL)
public RMIRegistry.Builder addCodebases(java.net.URL... urls)
urls
- the URLs of the code-basesaddCodebase(URL)
public RMIRegistry.Builder addCodebase(java.lang.String url) throws java.net.MalformedURLException
url
- the URL to the codebasejava.net.MalformedURLException
- if the specified URL is malformedaddCodebase(URL)
public RMIRegistry.Builder addCodebases(java.lang.String... urls) throws java.net.MalformedURLException
urls
- the URLs of the code-basesjava.net.MalformedURLException
- if any of the specified URLs is malformedaddCodebase(URL)
public RMIRegistry.Builder clearCodebasesSet()
addCodebase(URL)
public RMIRegistry.Builder setHandlerFaultMaxLife(long handlerFaultMaxLife)
handler
. The actual life is
picked up by using an exponential distribution with a decay chosen basing on
this maximum life parameter.handlerFaultMaxLife
- the maximum handler
life before
a connection failure is simulated, in
milliseconds.public RMIRegistry build()
RMIRegistry
instance. After this call, the builder will
not reset and it will be reusable to build new RMIRegistry
instances.RMIRegistry
instance