org.jacorb.notification.servant
Class AbstractProxySupplier

java.lang.Object
  extended by org.jacorb.notification.servant.AbstractProxy
      extended by org.jacorb.notification.servant.AbstractProxySupplier
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, Disposable, FilterStage, MessageConsumer, ManageableServant, QoSAdminOperations, NotifySubscribeOperations, FilterAdminOperations
Direct Known Subclasses:
ProxyPullSupplierImpl, ProxyPushSupplierImpl, StructuredProxyPullSupplierImpl, StructuredProxyPushSupplierImpl

public abstract class AbstractProxySupplier
extends AbstractProxy
implements MessageConsumer, NotifySubscribeOperations

Abstract base class for ProxySuppliers. This class provides following logic for the different ProxySuppliers:

Version:
$Id: AbstractProxySupplier.java,v 1.9 2004/05/06 12:39:59 nicolas Exp $
Author:
Alphonse Bendt

Field Summary
protected  java.lang.Runnable scheduleDeliverPendingMessagesOperation_
          Check if there are pending Messages and deliver them to the Consumer.
 
Fields inherited from class org.jacorb.notification.servant.AbstractProxy
admin_, channelContext_, id_, isIDPublic_, lifetimeFilter_, logger_, offerManager_, priorityFilter_, qosSettings_, subscriptionManager_, thisServant_
 
Constructor Summary
protected AbstractProxySupplier(AbstractAdmin admin, ChannelContext channelContext)
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
           
protected  void connectClient(Object client)
           
 void disableDelivery()
          Disable Deliveries. this MessageConsumer may not invoke remote operations. events are enqueued instead.
 void dispose()
          Dispose this Object.
 void enableDelivery()
          activate deliveries. this MessageConsumer may invoke remote operations again.
protected  void enqueue(Message message)
          put a Message in the queue of pending Messages.
protected  Message[] getAllMessages()
           
protected  Message[] getAtLeastMessages(int min)
           
 int getErrorThreshold()
          access the error threshold for this MessageConsumer. if the error count exeeds the threshold the MessageConsumer will be disconnected.
 TaskExecutor getExecutor()
           
protected  Message getMessageBlocking()
           
protected  Message getMessageNoBlock()
           
 int getPendingMessagesCount()
           
protected  Message[] getUpToMessages(int max)
           
protected  void handleFailedPushOperation(PushOperation operation, java.lang.Throwable error)
           
 boolean hasPendingData()
          check if this MessageConsumer has pending work to do. pending work is to push events to its connected (Push)Consumer.
protected  boolean isEnabled()
           
 boolean isPushSupplier()
           
 ConsumerAdmin MyAdmin()
           
 EventType[] obtain_offered_types(ObtainInfoMode obtainInfoMode)
           
 void preActivate()
           
 void setTaskExecutor(TaskExecutor executor)
           
 void setTaskExecutor(TaskExecutor executor, Disposable disposeTaskExecutor)
           
 void subscription_change(EventType[] added, EventType[] removed)
           
 
Methods inherited from class org.jacorb.notification.servant.AbstractProxy
_default_POA, add_filter, assertConnected, assertNotConnected, checkStillConnected, connectionResumed, connectionSuspended, deactivate, disconnectClient, get_all_filters, get_filter, get_qos, getErrorCounter, getFilters, getID, getLifetimeFilter, getORB, getPOA, getPriorityFilter, getTaskProcessor, handleDisconnected, hasInterFilterGroupOperatorOR, hasLifetimeFilter, hasPriorityFilter, incErrorCounter, isConnected, isDisposed, isIDPublic, isSuspended, lifetime_filter, lifetime_filter, MyType, priority_filter, priority_filter, remove_all_filters, remove_filter, resetErrorCounter, resume_connection, set_qos, setDisposeHook, setID, setOfferManager, setORB, setPOA, setSubscriptionManager, setTaskProcessor, suspend_connection, validate_event_qos, validate_qos
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jacorb.notification.interfaces.MessageConsumer
deliverMessage, deliverPendingData, getErrorCounter, incErrorCounter, isDisposed, resetErrorCounter
 
Methods inherited from interface org.jacorb.notification.interfaces.FilterStage
getMessageConsumer, getSubsequentFilterStages, hasMessageConsumer
 
Methods inherited from interface org.jacorb.notification.servant.ManageableServant
activate
 

Field Detail

scheduleDeliverPendingMessagesOperation_

protected java.lang.Runnable scheduleDeliverPendingMessagesOperation_
Check if there are pending Messages and deliver them to the Consumer. the operation is not executed immediately. instead it is scheduled to the Push Thread Pool. only initialized for ProxyPushSuppliers.

Constructor Detail

AbstractProxySupplier

protected AbstractProxySupplier(AbstractAdmin admin,
                                ChannelContext channelContext)
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class AbstractProxy

preActivate

public void preActivate()
                 throws UnsupportedQoS
Specified by:
preActivate in interface ManageableServant
Overrides:
preActivate in class AbstractProxy
Throws:
UnsupportedQoS

getExecutor

public TaskExecutor getExecutor()
Specified by:
getExecutor in interface MessageConsumer
Returns:
the TaskExecutor that should be used to push Messages to the connected Consumer.

setTaskExecutor

public void setTaskExecutor(TaskExecutor executor)

setTaskExecutor

public void setTaskExecutor(TaskExecutor executor,
                            Disposable disposeTaskExecutor)

getPendingMessagesCount

public int getPendingMessagesCount()

hasPendingData

public boolean hasPendingData()
Description copied from interface: MessageConsumer
check if this MessageConsumer has pending work to do. pending work is to push events to its connected (Push)Consumer.

Specified by:
hasPendingData in interface MessageConsumer

enqueue

protected void enqueue(Message message)
put a Message in the queue of pending Messages.

Parameters:
message - the Message to queue.

getMessageBlocking

protected Message getMessageBlocking()
                              throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

getMessageNoBlock

protected Message getMessageNoBlock()

getAllMessages

protected Message[] getAllMessages()

getUpToMessages

protected Message[] getUpToMessages(int max)

getAtLeastMessages

protected Message[] getAtLeastMessages(int min)

getErrorThreshold

public int getErrorThreshold()
Description copied from interface: MessageConsumer
access the error threshold for this MessageConsumer. if the error count exeeds the threshold the MessageConsumer will be disconnected.

Specified by:
getErrorThreshold in interface MessageConsumer

dispose

public final void dispose()
Description copied from interface: Disposable
Dispose this Object. Free all associated Ressources allocated by this Object. The Object may not be used after a call to dispose.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractProxy

MyAdmin

public final ConsumerAdmin MyAdmin()

subscription_change

public final void subscription_change(EventType[] added,
                                      EventType[] removed)
                               throws InvalidEventType
Specified by:
subscription_change in interface NotifySubscribeOperations
Throws:
InvalidEventType

obtain_offered_types

public final EventType[] obtain_offered_types(ObtainInfoMode obtainInfoMode)

connectClient

protected void connectClient(Object client)
Overrides:
connectClient in class AbstractProxy

enableDelivery

public void enableDelivery()
Description copied from interface: MessageConsumer
activate deliveries. this MessageConsumer may invoke remote operations again.

Specified by:
enableDelivery in interface MessageConsumer

disableDelivery

public void disableDelivery()
Description copied from interface: MessageConsumer
Disable Deliveries. this MessageConsumer may not invoke remote operations. events are enqueued instead.

Specified by:
disableDelivery in interface MessageConsumer

isEnabled

protected boolean isEnabled()

isPushSupplier

public boolean isPushSupplier()

handleFailedPushOperation

protected void handleFailedPushOperation(PushOperation operation,
                                         java.lang.Throwable error)