wt.manager
Class RemoteServerManager

java.lang.Object
  extended bywt.manager.RemoteServerManager

public class RemoteServerManager
extends Object

Class that provides access to a remote server manager. Instances of this class are local (non-remote) objects that encapsulate the communication with a remote server manager object. This encapsulation includes object location, and automatic recovery from communication errors.

The local object represents the "concept" of a remote server manager, 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.

Supported API: true
Extendable: false


Field Summary
private static Hashtable codebaseMap
           
protected  Registry currentRegistry
           
protected  ServerManager currentServerManager
           
private static Object lock
           
private static int MARSHAL_RETRY
           
private static int OTHER_RETRY
           
private static Object remoteServerManagerKey
           
private static String RESOURCE
           
private  URL serverCodebase
           
static boolean ServerFlag
          0 Server Manager flag - used to control conditional behavior in classes that may run in the server manager as well as outside the server manager.
private static boolean VERBOSE_CLIENT
           
 
Constructor Summary
protected RemoteServerManager(URL server_codebase)
          Construct a new RemoteServerManager object.
 
Method Summary
 Vector getAllServers(String service_name)
          Get all servers for the requested service_name.
static RemoteServerManager getDefault()
          Get default instance of RemoteServerManager.
 ServerManagerInfo getInfo()
          Get usage information.
static RemoteServerManager getInstance(URL server_codebase)
          Get instance of RemoteServermanager corresponding to the given server codebase URL.
protected  String getMessage(String key)
          Supported API: false
 Remote getNextServer(String service_name, Remote server)
          Get the next available server for the requested service_name.
protected  Registry getRegistry(Registry prev_registry)
          Get a remote registry instance associated with this RemoteMethodServer object.
 Remote getServer(String service_name)
          Get reference to a remote server object.
 Remote getServer(String service_name, int start_num)
          Get reference to a remote server object.
protected  ServerManager getServerManager(ServerManager prev_server_manager)
          Get a remote server manager instance associated with this RemoteServerManager object.
static void main(String[] args)
          Simple tester Displays info from the default server.
private static RemoteException newRemoteException(String msg, Throwable t)
           
 void ping()
          A no-op method available for testing communication.
private static void printRegistryException(RemoteException e)
           
private static void printRemoteException(RemoteException e)
           
 void registerServer(String service_name, Remote server)
          Register a new server instance.
 void reportDeadServer(String service_name, Remote server)
          Report a bad remote server reference.
 void reportDeadServer(String service_name, Remote server, Exception report_exception)
          Report a bad remote server reference.
private  void reportIncompatibleCodebase(String local_version, String server_version)
           
(package private)  void setServerManager(ServerManager server_manager)
           
 void stop()
          Stop the remote server manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

ServerFlag

public static boolean ServerFlag
0 Server Manager flag - used to control conditional behavior in classes that may run in the server manager as well as outside the server manager. Should be set to true only within the server manager itself.


MARSHAL_RETRY

private static final int MARSHAL_RETRY

OTHER_RETRY

private static final int OTHER_RETRY

VERBOSE_CLIENT

private static final boolean VERBOSE_CLIENT

remoteServerManagerKey

private static final Object remoteServerManagerKey

codebaseMap

private static Hashtable codebaseMap

lock

private static Object lock

serverCodebase

private URL serverCodebase

currentRegistry

protected Registry currentRegistry

currentServerManager

protected ServerManager currentServerManager
Constructor Detail

RemoteServerManager

protected RemoteServerManager(URL server_codebase)
Construct a new RemoteServerManager object. The server_codebase argument is used to load server properties necessary to establish communication with the remote server manager.

Supported API: false

Parameters:
server_codebase - the server codebase URL
Method Detail

setServerManager

void setServerManager(ServerManager server_manager)

getInstance

public static RemoteServerManager getInstance(URL server_codebase)
Get instance of RemoteServermanager corresponding to the given server codebase URL.

Supported API: true

Parameters:
server_codebase - the server codebase URL

getDefault

public static RemoteServerManager getDefault()
Get default instance of RemoteServerManager. The default instance is the one corresponding to the server codebase of the current thread as returned by the WTProperties class.

Supported API: true

See Also:
WTProperties

registerServer

public void registerServer(String service_name,
                           Remote server)
                    throws RemoteException
Register a new server instance. Called when servers are started and initialized. Only servers on the server manager's local host are allowed to register.

Supported API: false

Parameters:
service_name - service name corresponding to this remote server instance
server - the remote server instance
Throws:
RemoteException

getServer

public Remote getServer(String service_name)
                 throws RemoteException
Get reference to a remote server object. A service name is used to identify the type of server desired. If no server is available, one will be started by the server manager.

Supported API: true

Parameters:
service_name - the corresponding service name
Returns:
a remote server reference
Throws:
RemoteException

getServer

public Remote getServer(String service_name,
                        int start_num)
                 throws RemoteException
Get reference to a remote server object. A service name is used to identify the type of server desired. If no server is available, one will be started by the server manager.

Supported API: true

Parameters:
service_name - the corresponding service name
start_num - used in start up of multiple servers for this service
Returns:
a remote server reference
Throws:
RemoteException

getNextServer

public Remote getNextServer(String service_name,
                            Remote server)
                     throws RemoteException
Get the next available server for the requested service_name. The previous server is used for a reference and if no other server is available, null is returned. This method is used by servers that wish to redirect clients to other servers when doing load leveling.

Supported API: true

Parameters:
service_name - corresponding service name
server - previous server
Throws:
RemoteException

getAllServers

public Vector getAllServers(String service_name)
                     throws RemoteException
Get all servers for the requested service_name.

Supported API: true

Parameters:
service_name - corresponding service name
Returns:
a vector of remote server references
Throws:
RemoteException

reportDeadServer

public void reportDeadServer(String service_name,
                             Remote server)
                      throws RemoteException
Report a bad remote server reference. A bad reference is one that is no longer alive or is throwing unexpected exceptions when trying to invoke services.

Supported API: false

Parameters:
service_name - corresponding service name
server - the remote server reference
Throws:
RemoteException

reportDeadServer

public void reportDeadServer(String service_name,
                             Remote server,
                             Exception report_exception)
                      throws RemoteException
Report a bad remote server reference. A bad reference is one that is no longer alive or is throwing unexpected exceptions when trying to invoke services.

Supported API: false

Parameters:
service_name - corresponding service name
server - the remote server reference
report_exception - exception to report
Throws:
RemoteException

getInfo

public ServerManagerInfo getInfo()
                          throws RemoteException
Get usage information.

Supported API: false

Throws:
RemoteException

ping

public void ping()
          throws RemoteException
A no-op method available for testing communication.

Supported API: true

Throws:
RemoteException

stop

public void stop()
          throws RemoteException
Stop the remote server manager. Only calls originating from the server manager's local host will be honored.

Supported API: true

Throws:
RemoteException

getServerManager

protected ServerManager getServerManager(ServerManager prev_server_manager)
                                  throws RemoteException
Get a remote server manager instance associated with this RemoteServerManager object. This is used to establish the association with a remote server manager object, or to reestablish a new association during exception handling.

Supported API: false

Parameters:
prev_server_manager - previous remote instance (null to force new association)
Throws:
RemoteException

printRemoteException

private static void printRemoteException(RemoteException e)

printRegistryException

private static void printRegistryException(RemoteException e)

getRegistry

protected Registry getRegistry(Registry prev_registry)
                        throws RemoteException
Get a remote registry instance associated with this RemoteMethodServer object. This is used to establish the association with a remote registry object, or to reestablish a new association during exception handling.

Supported API: false

Parameters:
prev_registry - previous remote instance (null to force new association)
Throws:
RemoteException

reportIncompatibleCodebase

private void reportIncompatibleCodebase(String local_version,
                                        String server_version)

newRemoteException

private static RemoteException newRemoteException(String msg,
                                                  Throwable t)

getMessage

protected String getMessage(String key)
Supported API: false


main

public static void main(String[] args)
                 throws RemoteException
Simple tester Displays info from the default server.

Supported API: true

Throws:
RemoteException