xmlBlaster 2.2.0 API

org.xmlBlaster.client
Class UpdateDispatcher

java.lang.Object
  extended by org.xmlBlaster.client.UpdateDispatcher

public final class UpdateDispatcher
extends java.lang.Object

Dispatches callback messages depending on the subscriptionId to the specific client listener.

Author:
xmlBlaster@marcelruff.info

Nested Class Summary
(package private)  class UpdateDispatcher.CallbackInfo
          Inner helper class to hold ACK/NAK state of subscriptions.
 
Field Summary
private  java.util.HashMap callbackMap
          This map contains the registered callback interfaces for given subscriptions.
private  Global glob
           
private static java.lang.String ME
           
 
Constructor Summary
UpdateDispatcher(Global glob)
           
 
Method Summary
 void ackSubscription(java.lang.String subscriptionId)
          Mark that a subscribe() invocation returned (is the server ACK).
 void addCallback(java.lang.String subscriptionId, I_Callback callback, boolean isPersistent)
          Register a callback interface with the given subscriptionId
 void clear()
          Remove all callback registrations
 int clearAckNonPersistentSubscriptions()
          Clear all subscribes which where marked as acknowledged
 void clearNAKSubscriptions()
          Clear all subscribes which where not marked as acknowledged
 I_Callback getCallback(java.lang.String subscriptionId)
          Access a callback interface for the given subscriptionId
 I_Callback[] getCallbacks()
          Returns a current snapshot (shallow copy).
 java.lang.String[] getSubscriptionIds()
          Returns a current snapshot.
 I_Callback removeCallback(java.lang.String subscriptionId)
          Remove the callback interface for the given subscriptionId
 int size()
          Get number of callback registrations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private static final java.lang.String ME
See Also:
Constant Field Values

glob

private final Global glob

callbackMap

private final java.util.HashMap callbackMap
This map contains the registered callback interfaces for given subscriptions. The key is the subscription ID, the value is the I_Callback instance

Constructor Detail

UpdateDispatcher

public UpdateDispatcher(Global glob)
Method Detail

addCallback

public void addCallback(java.lang.String subscriptionId,
                        I_Callback callback,
                        boolean isPersistent)
Register a callback interface with the given subscriptionId


getCallback

public I_Callback getCallback(java.lang.String subscriptionId)
Access a callback interface for the given subscriptionId

Returns:
null if not found

ackSubscription

public void ackSubscription(java.lang.String subscriptionId)
Mark that a subscribe() invocation returned (is the server ACK).

Parameters:
subscriptionId - The subcribe

getCallbacks

public I_Callback[] getCallbacks()
Returns a current snapshot (shallow copy).


getSubscriptionIds

public java.lang.String[] getSubscriptionIds()
Returns a current snapshot.


removeCallback

public I_Callback removeCallback(java.lang.String subscriptionId)
Remove the callback interface for the given subscriptionId

Returns:
the removed entry of null if subscriptionId is unknown

size

public int size()
Get number of callback registrations


clear

public void clear()
Remove all callback registrations


clearAckNonPersistentSubscriptions

public int clearAckNonPersistentSubscriptions()
Clear all subscribes which where marked as acknowledged

Returns:
number of removed entries

clearNAKSubscriptions

public void clearNAKSubscriptions()
Clear all subscribes which where not marked as acknowledged


xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.