Novell exteNd Messaging Platform 5.2

com.sssw.jbroker.api.cluster
Class CustomPolicyContext

java.lang.Object
  extended bycom.sssw.jbroker.api.cluster.CustomPolicyContext
All Implemented Interfaces:
Serializable

public class CustomPolicyContext
extends Object
implements Serializable

The CustomPolicyContext class is used to carry context between invocations of the getAddress method of a custom policy controller callback implementation. If the CustomPolicyController can be invoked from multiple threads, the context should be used if the implementation requires to keep state to implement the custom clustering scheme.

The first time the getAddress method is called, the context will contain no data and no exception. The getAddress callback method can set arbitrary data (such as an index into the TCPAddress list) using the setContextData method, which will be available upon subsequent calls. On the second and subsequent invocations, the context's data will be whatever the callback set on the previous invocation. The getException method will return the exception that was raised when the ORB invoked the address previously returned by the getAddress method of the custom policy controller.

Since:
jBroker ORB 4.0
See Also:
CustomPolicyController, Serialized Form

Constructor Summary
CustomPolicyContext()
           
 
Method Summary
 Object getContextData()
          Get the context data previously set.
 SystemException getException()
          Get the exception raised when ORB invoked on the TCPAddress previously returned by the CustomPolicyController's getAddress method
 void setContextData(Object data)
          Set the context data for future invocations of getAddress.
 void setException(SystemException exception)
          Set the exception raised when ORB invoked on the TCPAddress returned by the CustomPolicyController's getAddress method
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomPolicyContext

public CustomPolicyContext()
Method Detail

getContextData

public Object getContextData()
Get the context data previously set.

Returns:
the context data or null if none set

setContextData

public void setContextData(Object data)
Set the context data for future invocations of getAddress. A custom policy controller might for instance set state used in the custom cluster algorithm such as TCP addresses that have already been tried.

Parameters:
data - the context data

getException

public SystemException getException()
Get the exception raised when ORB invoked on the TCPAddress previously returned by the CustomPolicyController's getAddress method

Returns:
the last system exception, or null when getAddress is invoked the first time

setException

public void setException(SystemException exception)
Set the exception raised when ORB invoked on the TCPAddress returned by the CustomPolicyController's getAddress method

Parameters:
exception - the last system exception

Novell exteNd Messaging Platform 5.2

exteNd is a registered trademark of Novell, Inc.
Copyright 1998-2004 Novell, Inc. All Rights Reserved.