|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.method.RemoteMethodServer
Class that provides access to a remote method server. Instances of this class are local (non-remote) objects that encapsulate the communication with a remote method server object. This encapsulation includes object location, and automatic recovery from communication errors.
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
Constructor Summary | |
protected |
RemoteMethodServer(RemoteServerManager server_manager,
String service_name)
Construct a new RemoteMethodServer object. |
Method Summary | |
Vector |
getAllInfo()
Get some general info from all remote method server instances Supported API: false |
MethodAuthenticator |
getAuthenticator()
Get the MethodAuthenticator to use for the current thread. |
private MethodServer |
getCurrentMethodServer()
|
static RemoteMethodServer |
getDefault()
Get default instance of RemoteMethodServer . |
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. |
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. |
MethodServerInfo |
getInfo()
Get some general info from a remote method server instance Supported API: false |
static RemoteMethodServer |
getInstance(URL server_codebase)
Get instance of RemoteMethodServer corresponding to the given
server codebase URL. |
static RemoteMethodServer |
getInstance(URL server_codebase,
String service_name)
Get instance of RemoteMethodServer corresponding to the given
server codebase URL. |
protected String |
getMessage(String key)
Get text of a localized message. |
protected MethodServer |
getMethodServer(MethodServer prev_method_server,
Exception report_exception)
Get a remote method server instance associated with this RemoteMethodServer
object. |
String |
getPassword()
Get the password set for this instance by the setPassword method. |
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. |
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. |
String |
getUserName()
Get the user name set for this instance by the setUserName method. |
protected MethodAuthenticator |
handleAuthenticationException(Throwable server_exception,
MethodAuthenticator authenticator,
MethodArgs invoke_args)
Handle AuthenticationExceptions thrown from the server. |
protected MethodServer |
handleServerLoadException(Throwable server_exception,
MethodServer prev_method_server)
Handle load balancing to a new server when current server throws a ServerLoadException. |
protected MethodAuthenticator |
initAuthenticator(MethodAuthenticator authenticator)
Initialize a new method authenticator. |
Object |
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. |
protected boolean |
isAuthenticationException(Object obj)
Check if an object is an instance of AuthenticationException. |
protected boolean |
isServerLoadException(Object obj)
Check if an object is an instance of ServerLoadException. |
static void |
main(String[] args)
Simple tester Displays info from the default server. |
private static RemoteException |
newRemoteException(String msg,
Throwable t)
|
static void |
ping()
Simple ping tester. |
private static void |
printRemoteException(RemoteException e)
|
void |
setAuthenticator(MethodAuthenticator authenticator)
Set the MethodAuthenticator to use for the current thread. |
private void |
setCurrentMethodServer(MethodServer server)
|
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. |
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. |
void |
setPassword(String password)
Set the password that will be made available to a method authenticator capable of password based authentication. |
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. |
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. |
void |
setUserName(String user_name)
Set the user name that will be made available to a method authenticator capable of user name based authentication. |
void |
stopAllServers()
Get some general info from all remote method server instances Supported API: false |
boolean |
streamingSupported()
Determine if streaming calls are supported. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
public static boolean ServerFlag
private static final int MARSHAL_RETRY
private static final int OTHER_RETRY
private static final boolean BUFFERED_INPUT
private static final boolean CLIENT_METHOD_TIMING
private static final boolean VERBOSE_CLIENT
private static final String SERVICE_NAME
private static final int SERVER_COUNT
private static Hashtable codebaseMaps
private static final Object lock
private static final Object DEFAULT_INSTANCE_KEY
private static final Object PRIVATE_AUTH_KEY
private static boolean defaultPrivateAuthentication
private static final Object PRIVATE_AFFINITY_KEY
private static boolean defaultPrivateAffinity
private final Object AUTHENTICATOR_KEY
private final Object USER_NAME_KEY
private final Object PASSWORD_KEY
private final Object CURRENT_SERVER_KEY
private static boolean usePrivateAuthenticators
private static boolean usePrivateAffinity
private RemoteServerManager serverManager
private String serviceName
private int currentMethodServer
private MethodServer[] servers
private MethodAuthenticator currentAuthenticator
private Object authenticatorLock
private String userName
private String password
private int activeCalls
private Object activeCallsLock
private int maxActiveCalls
Constructor Detail |
protected RemoteMethodServer(RemoteServerManager server_manager, String service_name)
RemoteMethodServer
object.
server_manager
- RemoteServerManager
object used to get server referenceRemoteServerManager
Method Detail |
public static RemoteMethodServer getInstance(URL server_codebase)
RemoteMethodServer
corresponding to the given
server codebase URL.
server_codebase
- the server codebase URLpublic static RemoteMethodServer getInstance(URL server_codebase, String service_name)
RemoteMethodServer
corresponding to the given
server codebase URL.
server_codebase
- the server codebase URLservice_name
- the service name registered by the serverpublic static RemoteMethodServer getDefault()
RemoteMethodServer
.
The default instance is the one corresponding to the server codebase of the
current thread as returned by the WTProperties
class.
WTProperties
public static boolean getPrivateAuthentication()
public static void setPrivateAuthentication(boolean private_auth)
The setting affects calls originating in threads that share the current thread's
WTContext
. The default for a WTContext
is to use shared
authentication.
Supported API: true
private_auth
- true
indicates private, false
indicates sharedpublic static boolean getDefaultPrivateAuthentication()
public static void setDefaultPrivateAuthentication(boolean private_auth)
private_auth
- true
indicates private, false
indicates sharedpublic static boolean getPrivateAffinity()
public static void setPrivateAffinity(boolean private_affinity)
The setting affects calls originating in threads that share the current thread's
WTContext
. The default for a WTContext
is to use shared
server affinity.
Supported API: true
private_affinity
- true
indicates private, false
indicates sharedpublic static boolean getDefaultPrivateAffinity()
public static void setDefaultPrivateAffinity(boolean private_affinity)
private_affinity
- true
indicates private, false
indicates sharedpublic void setUserName(String user_name)
WTContext
, this user name will not be shared
with other contexts.
user_name
- User name, or null to remove setting.public String getUserName()
setUserName
method.
public void setPassword(String password)
WTContext
, this password will not be shared
with other contexts. The password is encoded in memory so it does not remain in clear text.
password
- Password, or null to remove setting.public String getPassword()
setPassword
method.
public Object invoke(String target_method, String target_class, Object target_object, Class[] arg_types, Object[] args) throws RemoteException, InvocationTargetException
InvocationTargetException
.
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
RemoteException
- any exception trying to call the target method
InvocationTargetException
- any exception thrown by the target methodMethod.invoke(java.lang.Object, java.lang.Object[])
protected boolean isServerLoadException(Object obj)
protected MethodServer handleServerLoadException(Throwable server_exception, MethodServer prev_method_server)
protected boolean isAuthenticationException(Object obj)
protected MethodAuthenticator handleAuthenticationException(Throwable server_exception, MethodAuthenticator authenticator, MethodArgs invoke_args)
protected MethodAuthenticator initAuthenticator(MethodAuthenticator authenticator)
authenticator
- the MethodAuthenticator
object
MethodAuthenticator
objectpublic MethodAuthenticator getAuthenticator()
MethodAuthenticator
to 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.
public void setAuthenticator(MethodAuthenticator authenticator)
MethodAuthenticator
to 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.
protected MethodServer getMethodServer(MethodServer prev_method_server, Exception report_exception) throws RemoteException
RemoteMethodServer
object. This is used to establish the association with a remote method server object,
or to reestablish a new association during exception handling.
prev_method_server
- previous remote instance (null to force new association)
RemoteException
private MethodServer getCurrentMethodServer()
private void setCurrentMethodServer(MethodServer server)
public MethodServerInfo getInfo() throws RemoteException
RemoteException
public Vector getAllInfo() throws RemoteException
RemoteException
public void stopAllServers() throws RemoteException
RemoteException
private static void printRemoteException(RemoteException e)
public boolean streamingSupported() throws RemoteException
RemoteException
public static void ping() throws RemoteException
RemoteException
private static RemoteException newRemoteException(String msg, Throwable t)
protected String getMessage(String key)
public static void main(String[] args) throws RemoteException
RemoteException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |