osl.handler
Class RequestHandler

java.lang.Object
  |
  +--osl.handler.RequestHandler

public class RequestHandler
extends java.lang.Object

The request handler abstracts over the low-level transport layer interactions by providing an asynchronous/synchronous remote procedure call mechanism. Using the request handler, clients may invoke functions on other remote/local request handler clients. All that is required to make an invocation is the Name of the remote client, which may be obtained using the registry lookup functions.

Clients expose methods for remote requests by extending the RequestClient interface. Upon opening a new session, the request handler computes the set of remotely visible methods as follows:

  1. Set visibleMethods to null.
  2. Let rtClass be the run-time class of the client.
  3. For each interface i implemented by rtClass:
    1. If i extends RequestClient:
      1. For each public method j of i:
        1. Add j to visibleMethods

This mechanism is provided so that clients may provide local services by declaring them public without accidentally exposing these services to remote clients.

Version:
$Revision: 1.4 $ ($Date: 1998/10/05 15:47:36 $)
See Also:
TransportLayer, RequestSession, RequestException, RequestClient

Field Summary
static boolean DEBUG
          Set to true if you want debugging output.
 
Constructor Summary
RequestHandler()
          The default class constructor.
 
Method Summary
 void handlerInitialize(Scheduler S, TransportLayer T, NameService N)
          This method is called to initialize a RequestHandler instance once it has been instantiatied.
 RequestSession handlerOpenSession(RequestClient client)
          This method is called to open a new request handler session.
 RequestSession handlerOpenSession(RequestClient client, PhysicalAddress request)
          This method is called to open a new request handler session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
Set to true if you want debugging output.
Constructor Detail

RequestHandler

public RequestHandler()
The default class constructor. Not much to do here.
Method Detail

handlerInitialize

public void handlerInitialize(Scheduler S,
                              TransportLayer T,
                              NameService N)
This method is called to initialize a RequestHandler instance once it has been instantiatied.
Parameters:
S - A reference to the scheduler which should be used to schedule handler threads.
T - A reference to the transport layer which should be used to transmit and receive requests.
N - A reference to the name service which should be used to lookup the PhysicalAddress associated with a particular name.

handlerOpenSession

public RequestSession handlerOpenSession(RequestClient client)
                                  throws RequestException
This method is called to open a new request handler session. This version assigns the first available PhysicalAddress.
Parameters:
client - A reference to the object which will receive remote requests for this session.
Throws:
RequestException - Thrown if an error occurs while opening the session. An error thrown here is usually caused by an exception in the transport layer.

handlerOpenSession

public RequestSession handlerOpenSession(RequestClient client,
                                         PhysicalAddress request)
                                  throws RequestException
This method is called to open a new request handler session. This version allows the caller to request that a particular PhysicalAddress be associated with the new session.
Parameters:
client - A reference to the object which will receive remote requests for this session.
request - The physical address which the handler should attempt to associate with this session.
Throws:
RequestException - Thrown if an error occurs while opening the session. An error thrown here is usually caused by an exception in the transport layer.