Class RemoteMethodServer
The local object represents the "concept" of a remote method server, not a particular instance of the remote server object. This allows the local object to manage connecting to a server object, and reconnecting to new server objects during error recovery.
Error recovery consists of automatically retrying calls that fail due to communication
failures. Argument classes that are consumed by serialization should throw a
NotSerializableException to abort retries if re-serialization is not valid.
If the calling thread is an instance of wt.util.WTThread, interrupting the
thread while it is invoking a remote method will cause the corresponding remote thread
in the method server to be interrupted. This allows the client to abort long running
server operations by interrupting the calling thread.
Supported API: true
Extendable: false
-
Method Summary
Modifier and TypeMethodDescriptionGet theMethodAuthenticatorto use for the current thread.static RemoteMethodServerGet default instance ofRemoteMethodServer.static booleanGet default value of whether or not calls from different contexts will use private server affinity or share server affinity with other contexts accessing the same server.static booleanReturn default value of whether or not calls from will use a private method authenticator or share authentication with other contexts accessing the same server.static RemoteMethodServergetInstance(URL server_codebase) Get instance ofRemoteMethodServercorresponding to the given server codebase URL.static RemoteMethodServergetInstance(URL server_codebase, String service_name) Get instance ofRemoteMethodServercorresponding to the given server codebase URL.Get the password set for this instance by thesetPasswordmethod.static booleanReturn whether or not calls from the current context will use private server affinity or share server affinity with other contexts accessing the same server.static booleanReturn whether or not calls from the current context will use a private method authenticator or share authentication with other contexts accessing the same server.Get the user name set for this instance by thesetUserNamemethod.invoke(String target_method, String target_class, Object target_object, Class[] arg_types, Object[] args) Invoke the specified target method with the remote method server.static voidSimple tester Displays info from the default server.static voidping()Simple ping tester.voidsetAuthenticator(MethodAuthenticator authenticator) Set theMethodAuthenticatorto use for the current thread.static voidsetDefaultPrivateAffinity(boolean private_affinity) Set default value of whether or not calls from different contexts will use private server affinity or share server affinity with other contexts accessing the same server.static voidsetDefaultPrivateAuthentication(boolean private_auth) Set default value of whether or not calls will use a private method authenticator or share authentication with other contexts accessing the same server.voidsetPassword(String password) Set the password that will be made available to a method authenticator capable of password based authentication.static voidsetPrivateAffinity(boolean private_affinity) Set whether or not calls from the current context will maintain server affinity separately from other contexts or share server affinity with other contexts accessing the same remote method server.static voidsetPrivateAuthentication(boolean private_auth) Set whether or not calls from the current context will use a private method authenticator or share authentication with other contexts accessing the same server.voidsetUserName(String user_name) Set the user name that will be made available to a method authenticator capable of user name based authentication.booleanDetermine if streaming calls are supported.
-
Method Details
-
getInstance
Get instance ofRemoteMethodServercorresponding to the given server codebase URL.
Supported API: true- Parameters:
server_codebase- the server codebase URL
-
getInstance
Get instance ofRemoteMethodServercorresponding to the given server codebase URL.
Supported API: true- Parameters:
server_codebase- the server codebase URLservice_name- the service name registered by the server
-
getDefault
Get default instance ofRemoteMethodServer. The default instance is the one corresponding to the server codebase of the current thread as returned by theWTPropertiesclass.
Supported API: true- See Also:
-
getPrivateAuthentication
public static boolean getPrivateAuthentication()Return whether or not calls from the current context will use a private method authenticator or share authentication with other contexts accessing the same server.
Supported API: true- Returns:
- private authentication setting
-
setPrivateAuthentication
public static void setPrivateAuthentication(boolean private_auth) Set whether or not calls from the current context will use a private method authenticator or share authentication with other contexts accessing the same server. Normally, all contexts that share access to a remote method server will use the same security context. This method allows multi-user applications to establish separate security contexts for different calling contexts.The setting affects calls originating in threads that share the current thread's
WTContext. The default for aWTContextis to use shared authentication.
Supported API: true- Parameters:
private_auth-trueindicates private,falseindicates shared
-
getDefaultPrivateAuthentication
public static boolean getDefaultPrivateAuthentication()Return default value of whether or not calls from will use a private method authenticator or share authentication with other contexts accessing the same server.
Supported API: true- Returns:
- private authentication setting
-
setDefaultPrivateAuthentication
public static void setDefaultPrivateAuthentication(boolean private_auth) Set default value of whether or not calls will use a private method authenticator or share authentication with other contexts accessing the same server.
Supported API: true- Parameters:
private_auth-trueindicates private,falseindicates shared
-
getPrivateAffinity
public static boolean getPrivateAffinity()Return whether or not calls from the current context will use private server affinity or share server affinity with other contexts accessing the same server.
Supported API: true- Returns:
- private authentication setting
-
setPrivateAffinity
public static void setPrivateAffinity(boolean private_affinity) Set whether or not calls from the current context will maintain server affinity separately from other contexts or share server affinity with other contexts accessing the same remote method server. Normally, all contexts that share access to a remote method server will use the same server instance. This method allows multi-user applications to establish separate server affinity for different calling contexts.The setting affects calls originating in threads that share the current thread's
WTContext. The default for aWTContextis to use shared server affinity.
Supported API: true- Parameters:
private_affinity-trueindicates private,falseindicates shared
-
getDefaultPrivateAffinity
public static boolean getDefaultPrivateAffinity()Get default value of whether or not calls from different contexts will use private server affinity or share server affinity with other contexts accessing the same server.
Supported API: true- Returns:
- private authentication setting
-
setDefaultPrivateAffinity
public static void setDefaultPrivateAffinity(boolean private_affinity) Set default value of whether or not calls from different contexts will use private server affinity or share server affinity with other contexts accessing the same server.
Supported API: true- Parameters:
private_affinity-trueindicates private,falseindicates shared
-
setUserName
Set the user name that will be made available to a method authenticator capable of user name based authentication. This information is managed by the RemoteMethodServer object because it manages the use of method authenticators. If private authentication is set for the current thread'sWTContext, this user name will not be shared with other contexts.
Supported API: true- Parameters:
user_name- User name, or null to remove setting.
-
getUserName
Get the user name set for this instance by thesetUserNamemethod.
Supported API: true- Returns:
- User name, or null if not set.
-
setPassword
Set the password that will be made available to a method authenticator capable of password based authentication. This information is managed by the RemoteMethodServer object because it manages the use of method authenticators. If private authentication is set for the current thread'sWTContext, this password will not be shared with other contexts. The password is encoded in memory so it does not remain in clear text.
Supported API: true- Parameters:
password- Password, or null to remove setting.
-
getPassword
Get the password set for this instance by thesetPasswordmethod.
Supported API: true- Returns:
- User name, or null if not set.
-
invoke
public Object invoke(String target_method, String target_class, Object target_object, Class[] arg_types, Object[] args) throws RemoteException, InvocationTargetException Invoke the specified target method with the remote method server. The method is dynamically invoked within the server and any uncaught exceptions thrown by the remote method are thrown here wrapped in aInvocationTargetException.
Supported API: true- Parameters:
target_method- the target method nametarget_class- the target class (for static methods only)target_object- the target object (for instance methods only)arg_types- an array of argument types used when looking up the methodargs- an array of argument objects for the method- Throws:
RemoteException- any exception trying to call the target methodInvocationTargetException- any exception thrown by the target method- See Also:
-
getAuthenticator
Get theMethodAuthenticatorto use for the current thread. If the current context uses a private authenticator, that one will be returned, otherwise the shared authenticator will be returned.
Supported API: true -
setAuthenticator
Set theMethodAuthenticatorto use for the current thread. If the current context does not use a private authenticator, this will set the shared authenticator. Setting to null removes the current authenticator.
Supported API: true -
streamingSupported
Determine if streaming calls are supported. Streaming is not be supported when RMI is tunneled over HTTP or HTTPS requests since the argument and response objects are buffered in memory when building HTTP request and response bodies.
Supported API: true- Throws:
RemoteException
-
ping
Simple ping tester. Invokes a ping method that is built into the remote method server.
Supported API: true- Throws:
RemoteException
-
main
Simple tester Displays info from the default server. If an integer argument is supplied, it pings the server that many times.
Supported API: true- Throws:
RemoteException
-