|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectParkNPark.client.FaultTolerantClientManager
public class FaultTolerantClientManager
Fault tolerant client manager that wraps a remote ClientManager and rolls over to a new primary server in the presence of failures. Note that this class is not multi-thread safe. Multiple threads should synchronize access or wrap this class with a thread-safe delegate.
| Nested Class Summary | |
|---|---|
protected class |
FaultTolerantClientManager.ReturnValueOrException
Return value or an exception along with the return value or the exception object. |
| Field Summary | |
|---|---|
protected int |
clientID
The server-generated client ID |
protected static Method |
closeClientManager
|
protected static Method |
enterLot
|
protected static Method |
exitLot
|
protected ClientManagerFactory |
factory
The last-known client manager factory instance |
protected static Method |
getClientID
|
protected static Method |
getCurrentLevel
|
protected static Method |
getLots
|
protected static Method |
getMaxLevel
|
protected static Method |
getMinLevel
|
protected static Method |
getOtherLotAvailability
|
protected static PrintStream |
inputEater
Shared static instance of the input eater output stream wrapped in a PrintStream |
private int |
interRequestTime
Time between requests |
protected Logger |
logger
Our Logger instance |
protected static Method |
moveDownLevel
|
protected static Method |
moveUpLevel
|
protected NamingContextExt |
nameServer
Our name server instance |
protected ORB |
orb
Our object request broker |
protected NamingContext |
parkNParkContext
Our naming service's ParkNPark context, which contains server registrations |
protected ClientManager |
primaryClientManager
The primary client manager |
protected int |
seq
The latest sequence number from the client |
protected static String |
unexpectedException
Message for unexpected exceptions that arise during remote method calls (non-IDL and non-CORBA exceptions) |
| Constructor Summary | |
|---|---|
FaultTolerantClientManager(ORB orb,
Logger logger,
int interRequestTime)
Creates a new fault-tolerant client manager that automatically fails over to new primary servers on method call failures |
|
| Method Summary | |
|---|---|
protected FaultTolerantClientManager.ReturnValueOrException |
callServer(Method method,
Object... arguments)
Calls the given method on the server with the given arguments and returns a ReturnValueOrException object to indicate a normal or exceptional result and contain the return value or the exception object. |
void |
closeClientManager()
Closes the client manager and frees server resources associated with it, including the client manager's activation in the server's CORBA portable object adapter |
PaddedIntegerSeq |
enterLot(int seq,
int lot)
Moves the client's car into the lot with the given lot number and returns an array of level numbers that have available spaces |
PaddedVoid |
exitLot(int seq)
Removes the client's car from the lot that it is currently in |
PaddedInteger |
getClientID()
Returns the client's ID, which can be used in the client manager factory's getExistingClientManager() method |
PaddedInteger |
getCurrentLevel()
Returns the car's current level number |
PaddedIntegerSeq |
getLots()
Returns an array of valid lot numbers in the system, sorted by the lot number in ascending order |
PaddedInteger |
getMaxLevel()
Returns the top level number of the car's current parking lot |
PaddedInteger |
getMinLevel()
Returns the bottom level number of the car's current parking lot |
PaddedIntegerSeq |
getOtherLotAvailability(int lot)
Returns an array of other lots that have availability, sorted by lot distance such that closer lots are listed first |
protected boolean |
getPrimaryServer()
Refreshes the primary server that is registered in the name service |
void |
hoseServerDatabaseConnection()
Hoses the server's database connection. |
protected void |
interRequestWait()
Wait for the configured inter-request wait period or, if none is configured, return immediately. |
PaddedInteger |
moveDownLevel(int seq)
Moves the car from its present level to the level beneath it |
PaddedInteger |
moveUpLevel(int seq)
Moves the car from its present level to the level above it |
protected boolean |
refreshParkNParkContext()
Refreshes the parkNParkContext name service object that we use to get server bindings on. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected NamingContext parkNParkContext
protected ClientManager primaryClientManager
protected NamingContextExt nameServer
protected int seq
protected int clientID
protected ClientManagerFactory factory
protected ORB orb
private int interRequestTime
protected Logger logger
protected static final Method getClientID
protected static final Method enterLot
protected static final Method exitLot
protected static final Method getOtherLotAvailability
protected static final Method getLots
protected static final Method moveUpLevel
protected static final Method moveDownLevel
protected static final Method getCurrentLevel
protected static final Method getMaxLevel
protected static final Method getMinLevel
protected static final Method closeClientManager
protected static final String unexpectedException
protected static PrintStream inputEater
| Constructor Detail |
|---|
public FaultTolerantClientManager(ORB orb,
Logger logger,
int interRequestTime)
throws ServiceUnavailableException
orb - The object request broker instance to uselogger - The Logger instance to write performance data tointerRequestTime - The time to wait between method invocations
ServiceUnavailableException - Thrown when a primary server could not be
located or contacted| Method Detail |
|---|
protected FaultTolerantClientManager.ReturnValueOrException callServer(Method method,
Object... arguments)
method - The method to call on our client manager on the primary serverarguments - The arguments to pass to the given method's parameters
protected boolean getPrimaryServer()
protected boolean refreshParkNParkContext()
public PaddedInteger getClientID()
getClientID in interface ClientManagerOperations
public PaddedIntegerSeq enterLot(int seq,
int lot)
throws AlreadyInLotException,
LotNotFoundException,
LotFullException,
ServiceUnavailableException
enterLot in interface ClientManagerOperationsseq - The latest sequence number of the clientlot - The lot number to enter
AlreadyInLotException - Thrown when the client's car is already in a lot
LotNotFoundException - Thrown if the given lot number is not known to the system
LotFullException - Thrown if the given lot is full
ServiceUnavailableException - Thrown if the database cannot be contacted or if some
other reason prevents the car from entering the lot
public PaddedVoid exitLot(int seq)
throws NotInLotException,
NotOnExitLevelException,
ServiceUnavailableException
exitLot in interface ClientManagerOperationsseq - The latest sequence number of the client
NotInLotException - Thrown if the car is not in a lot
NotOnExitLevelException - Thrown if the car is in a lot but is not on a permitted
exit level
ServiceUnavailableException - Thrown if the database cannot be contacted or if some
other reason prevents the car from exiting the lot
[Category: Baseline; Requirement: 7]
public PaddedIntegerSeq getOtherLotAvailability(int lot)
throws LotNotFoundException,
ServiceUnavailableException
getOtherLotAvailability in interface ClientManagerOperationslot - The lot to get lot distances from
LotNotFoundException - Thrown if the given lot number is not known to the system
ServiceUnavailableException - Thrown if the database cannot be contacted or if
some other reason prevents the system from discovering the availability of other lots
public PaddedIntegerSeq getLots()
throws ServiceUnavailableException
getLots in interface ClientManagerOperationsServiceUnavailableException - Thrown if the database cannot be contacted or if some
other reason prevents the system from discovering the its defined lots
public PaddedInteger moveUpLevel(int seq)
throws NotInLotException,
AtTopLevelException,
ServiceUnavailableException
moveUpLevel in interface ClientManagerOperationsseq - The latest sequence number of the client
NotInLotException - Thrown if the car is not in a lot
AtTopLevelException - Thrown if the car is already on the highest level
ServiceUnavailableException - Thrown if the database cannot be contacted or if some
other reason prevents the car from moving to the next highest level
public PaddedInteger moveDownLevel(int seq)
throws NotInLotException,
AtBottomLevelException,
ServiceUnavailableException
moveDownLevel in interface ClientManagerOperationsseq - The latest sequence number of the client
NotInLotException - Thrown if the car is not in a lot
AtTopLevelException - Thrown if the car is already on the lowest level
ServiceUnavailableException - Thrown if the database cannot be contacted or if some other reason prevents the car from moving to the lower level
AtBottomLevelException
public PaddedInteger getCurrentLevel()
throws NotInLotException,
ServiceUnavailableException
getCurrentLevel in interface ClientManagerOperationsNotInLotException - Thrown if the car is not in a lot
ServiceUnavailableException - Thrown if the database cannot be contacted or if some
other reason prevents the system from returning the car's current level
public PaddedInteger getMaxLevel()
throws NotInLotException,
ServiceUnavailableException
getMaxLevel in interface ClientManagerOperationsNotInLotException - Thrown if the car is not in a lot
ServiceUnavailableException - Thrown if the database cannot be contacted or if some
other reason prevents the system from returning the current lot's highest level
public PaddedInteger getMinLevel()
throws NotInLotException,
ServiceUnavailableException
getMinLevel in interface ClientManagerOperationsNotInLotException - Thrown if the car is not in a lot
ServiceUnavailableException - Thrown if the database cannot be contacted or if some
other reason prevents the system from returning the current lot's lowest level
public void closeClientManager()
throws ServiceUnavailableException
closeClientManager in interface ClientManagerOperationsServiceUnavailableException - Thrown if the database cannot be contacted or if some
other reason prevents the system from closing the client manager. The client manager remains
open if this exception gets thrownprotected void interRequestWait()
public void hoseServerDatabaseConnection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||