org.objectweb.joram.mom.proxies
Class ClientContext

java.lang.Object
  extended by org.objectweb.joram.mom.proxies.ClientContext
All Implemented Interfaces:
java.io.Serializable

 class ClientContext
extends java.lang.Object
implements java.io.Serializable

The ClientContext class holds the data related to a client context.


Nested Class Summary
(package private) static class ClientContext.MultiReplyContext
           
 
Field Summary
private  java.util.Vector activeSubs
          Vector of active subscriptions' names.
private  int cancelledRequestId
          Identifier of a cancelled "receive" request, set when a PTP listener has been unset.
private  java.util.Hashtable commitTable
          Contexts waiting for the replies from some local agents
private  java.util.Hashtable deliveringQueues
          Identifiers of queues delivering messages.
private  int id
          Context identifier.
static org.objectweb.util.monolog.api.Logger logger
          logger
private  ProxyAgentItf proxy
           
private  AgentId proxyId
          The proxy's agent identifier.
private  java.util.Vector repliesBuffer
          Pending replies waiting for the context to be activated.
private static long serialVersionUID
          define serialVersionUID for interoperability
private  boolean started
          true if the context is activated.
private  java.util.Vector tempDestinations
          Vector of temporary destinations.
private  java.util.Hashtable transactionsTable
          Prepared transactions objects waiting for commit.
 
Constructor Summary
ClientContext(AgentId proxyId, int id)
          Constructs a ClientContext instance.
 
Method Summary
(package private)  void addDeliveringQueue(AgentId queueId)
          Adds the identifier of a delivering queue.
(package private)  void addMultiReplyContext(int requestId, int asyncReplyCount)
          Some requests may require to wait for several SendReplyNot notifications before replying to the client.
(package private)  void addPendingDelivery(AbstractJmsReply reply)
          Adds a pending delivery.
(package private)  void addSubName(java.lang.String subName)
          Adds an active subscription name.
(package private)  void addTemporaryDestination(AgentId destId)
          Adds a temporary destination identifier.
(package private)  void cancelReceive(int cancelledRequestId)
          Cancels a "receive" request.
(package private)  void clearPendingDeliveries()
          Clears the pending deliveries buffer.
(package private)  boolean getActivated()
          Returns true if the context is activated.
(package private)  java.util.Iterator getActiveSubs()
          Returns the active subscriptions' names.
(package private)  int getCancelledReceive()
          Returns the cancelled "receive" request identifier.
(package private)  java.util.Iterator getDeliveringQueues()
          Returns the identifiers of the delivering queues.
(package private)  int getId()
          Returns the identifier of the context.
(package private)  java.util.Iterator getPendingDeliveries()
          Returns the pending deliveries.
(package private)  java.util.Iterator getTempDestinations()
           
(package private)  java.util.Iterator getTxIds()
          Returns the identifiers of the prepared transactions.
(package private)  XACnxPrepare getTxPrepare(java.lang.Object key)
          Returns and deletes a given transaction "prepare".
 boolean isPrepared(java.lang.Object key)
           
 void readBag(java.io.ObjectInputStream in)
           
(package private)  void registerTxPrepare(java.lang.Object key, XACnxPrepare prepare)
          Registers a given transaction "prepare".
(package private)  void removeSubName(java.lang.String subName)
          Removes an active subscription name.
(package private)  void removeTemporaryDestination(AgentId destId)
          Removes a temporary destination identifier.
(package private)  void setActivated(boolean started)
          Sets the activation status of the context.
(package private)  void setProxyAgent(ProxyAgentItf px)
           
(package private)  int setReply(int requestId)
          Called by UserAgent when a SendReplyNot arrived.
 java.lang.String toString()
           
 void writeBag(java.io.ObjectOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
define serialVersionUID for interoperability

See Also:
Constant Field Values

logger

public static org.objectweb.util.monolog.api.Logger logger
logger


proxyId

private AgentId proxyId
The proxy's agent identifier.


id

private int id
Context identifier.


tempDestinations

private java.util.Vector tempDestinations
Vector of temporary destinations.


deliveringQueues

private java.util.Hashtable deliveringQueues
Identifiers of queues delivering messages.


transactionsTable

private java.util.Hashtable transactionsTable
Prepared transactions objects waiting for commit.


started

private transient boolean started
true if the context is activated.


cancelledRequestId

private transient int cancelledRequestId
Identifier of a cancelled "receive" request, set when a PTP listener has been unset.


activeSubs

private transient java.util.Vector activeSubs
Vector of active subscriptions' names.


repliesBuffer

private transient java.util.Vector repliesBuffer
Pending replies waiting for the context to be activated.


commitTable

private transient java.util.Hashtable commitTable
Contexts waiting for the replies from some local agents


proxy

private transient ProxyAgentItf proxy
Constructor Detail

ClientContext

ClientContext(AgentId proxyId,
              int id)
Constructs a ClientContext instance.

Parameters:
proxyId - The proxy's agent identifier.
id - Identifier of the context.
Method Detail

setProxyAgent

void setProxyAgent(ProxyAgentItf px)

getId

int getId()
Returns the identifier of the context.


setActivated

void setActivated(boolean started)
Sets the activation status of the context.


getActivated

boolean getActivated()
Returns true if the context is activated.


addTemporaryDestination

void addTemporaryDestination(AgentId destId)
Adds a temporary destination identifier.


getTempDestinations

java.util.Iterator getTempDestinations()

removeTemporaryDestination

void removeTemporaryDestination(AgentId destId)
Removes a temporary destination identifier.


addPendingDelivery

void addPendingDelivery(AbstractJmsReply reply)
Adds a pending delivery.


getPendingDeliveries

java.util.Iterator getPendingDeliveries()
Returns the pending deliveries.


clearPendingDeliveries

void clearPendingDeliveries()
Clears the pending deliveries buffer.


addSubName

void addSubName(java.lang.String subName)
Adds an active subscription name.


getActiveSubs

java.util.Iterator getActiveSubs()
Returns the active subscriptions' names.


removeSubName

void removeSubName(java.lang.String subName)
Removes an active subscription name.


cancelReceive

void cancelReceive(int cancelledRequestId)
Cancels a "receive" request.


getCancelledReceive

int getCancelledReceive()
Returns the cancelled "receive" request identifier.


addDeliveringQueue

void addDeliveringQueue(AgentId queueId)
Adds the identifier of a delivering queue.


getDeliveringQueues

java.util.Iterator getDeliveringQueues()
Returns the identifiers of the delivering queues.


addMultiReplyContext

void addMultiReplyContext(int requestId,
                          int asyncReplyCount)
Some requests may require to wait for several SendReplyNot notifications before replying to the client.

Parameters:
requestId -
asyncReplyCount -

setReply

int setReply(int requestId)
Called by UserAgent when a SendReplyNot arrived.

Parameters:
requestId -
Returns:
> 0 if there are still some pending replies 0 if all the replies arrived (the context is removed) or if the context doesn't exist

registerTxPrepare

void registerTxPrepare(java.lang.Object key,
                       XACnxPrepare prepare)
                 throws java.lang.Exception
Registers a given transaction "prepare".

Throws:
java.lang.Exception

getTxPrepare

XACnxPrepare getTxPrepare(java.lang.Object key)
Returns and deletes a given transaction "prepare".


isPrepared

public boolean isPrepared(java.lang.Object key)
Parameters:
key - XID
Returns:
true if prepared transation.

getTxIds

java.util.Iterator getTxIds()
Returns the identifiers of the prepared transactions.


readBag

public void readBag(java.io.ObjectInputStream in)
             throws java.io.IOException,
                    java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeBag

public void writeBag(java.io.ObjectOutputStream out)
              throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.