@Deprecated public interface NavuCdbSubscriber
The methods of this interface specifies method for starting/stopping and registering callback, a user implementation of which is ad hook code that needs to be able to react on Cdb changes.
A user of this API implements either NavuCdbConfigIterate, for configuration data paths or NavuCdbOperDiffIterate for operational data paths ( CDB oper ) data.
A user then registers the instance to register method to a subclass of NavuCdbSubscribers (NavuCdbConfigSubscriber or NavuCdbOperSubscriber ).
Modifier and Type | Method and Description |
---|---|
void |
awaitRunning()
Deprecated.
Blocks the calling thread until this
NavuCdbSubscriber
is in a running state. |
void |
awaitStopped()
Deprecated.
Blocks the calling thread until this subscriber have stopped.
|
ExecutorService |
executor()
Deprecated.
Retrieve the underlying
ExecutorService
of this subscriber. |
NavuCdbSubscriptionIterQueue |
getIterationQueue()
Deprecated.
Retrieve a iteration (notification) blocking queue where iteration
information from each made iteration could be received.
|
boolean |
isRunning()
Deprecated.
Return true if this subscriber is running.
|
boolean |
isStopped()
Deprecated.
Return true if this subscriber is stopped.
|
NavuCdbSubscriber |
register(NavuCdbDiffIterate cb,
ConfPath path)
Deprecated.
Register a user provided callback with a specified path.
|
NavuCdbSubscriber |
register(NavuCdbDiffIterate cb,
ConfPath path,
EnumSet<DiffIterateFlags> diffIterFlags)
Deprecated.
Register a user provided callback with a specified path with additional
iteration flags.
|
NavuCdbSubscriber |
register(NavuCdbDiffIterate cb,
NavuNode node)
Deprecated.
Register a user provided callback with a specified NavuNode.
|
NavuCdbSubscriber |
register(NavuCdbDiffIterate cb,
NavuNode node,
EnumSet<DiffIterateFlags> diffIterFlags)
Deprecated.
Register a user provided callback with a specified NavuNode with
additional iteration flags.
|
void |
registerStoppedHandler(NavuCdbStoppedHandler handler)
Deprecated.
Register callback which will be invoked on subscriber shutdown event.
|
void |
shutDownOnException(boolean shutdownonexc)
Deprecated.
Controls the shutdown behavior of this subscriber when the subscriber
receives a uncaught exception from one of its registered callbacks.
|
boolean |
subscriberStart()
Deprecated.
Starts a NavuCdbSubscriber asynchronously, if
the NavuCdbConfigSubscriber is not already been started.
|
boolean |
subscriberStop()
Deprecated.
Sends a Stop signal to the underlying subscription process
without shutting down the underlying
ExecutorService . |
void awaitRunning() throws InterruptedException
NavuCdbSubscriber
is in a running state.
The method subscriberStart()
starts the
NavuCdbSubscriber asynchronously. If it is desired
to wait until the NavuCdbSubscriber is running
the calling thread calls this method will block until it is running
state.
When a NavuCdbSubscriber starts it needs to do some processing work before it could read the underlying Cdb socket for notifications. This method is useful when we which to know when the NavuCdbSubscriber is reading the underlying Cdb socket for notification.
If the NavuCdbSubscriber is already running upon invocation of this method the calling thread will return immediately.
InterrupedException
- if the waiting process got interruptedInterruptedException
void awaitStopped() throws InterruptedException
The subscriber is stopped when it is not running.
The method subscriberStop()
stops the
NavuCdbSubscriber asynchronously. If it is desired
to wait until the NavuCdbSubscriber have stopped i.e when
the subscriber has released its internal resources
and it is ready for a restart this method will block the calling
thread until the subscriber is in a stopped state.
InterrupedException
- if the waiting process got interruptedInterruptedException
ExecutorService executor()
ExecutorService
of this subscriber.
If the underlying ExecutorService have been shutdown the subscriber can no longer be started.
NavuCdbSubscriptionIterQueue getIterationQueue()
For each iteration of a diff entry the queue receives summary information. For example of such information is a subscription point, path , oper flag ,result flag returned from user provided callback for particular iteration.
boolean isRunning()
boolean isStopped()
NavuCdbSubscriber register(NavuCdbDiffIterate cb, ConfPath path) throws NavuException
cb
- The user callback implementationpath
- The subscription pathNavuException
NavuCdbSubscriber register(NavuCdbDiffIterate cb, ConfPath path, EnumSet<DiffIterateFlags> diffIterFlags) throws NavuException
cb
- The user callback implementationpath
- The subscription pathNavuException
NavuCdbSubscriber register(NavuCdbDiffIterate cb, NavuNode node) throws NavuException
cb
- The callback implementationnode
- The subscription nodeNavuException
NavuCdbSubscriber register(NavuCdbDiffIterate cb, NavuNode node, EnumSet<DiffIterateFlags> diffIterFlags) throws NavuException
cb
- The callback implementationnode
- The subscription nodeNavuException
void registerStoppedHandler(NavuCdbStoppedHandler handler)
handler
- A register handler upon shutdown event by ConfD/NCSvoid shutDownOnException(boolean shutdownonexc)
When a user callback throws unexpected exception that is not caught
by the callback the default behavior for a
NavuCdbConfigSubscriber is to sync with
CdbSubscriptionSyncType.DONE_SOCKET
and stops
the subscriber and shutdown the underlying ExecutorService.
This method defines if the subscriber should stop when an uncaught exception from callback is thrown.
shutdownonexc
- true/false whether this subscriber should stop
after a uncaught exception from one of the set of callbacks is thrown.boolean subscriberStart()
After all the registration have been done
the subscriber must be started which submits this subscriber
to the underlying ExecutorService
Returns true if this subscriber was successfully started false if the subscriber was already started or is running.
This method is thread safe only one thread at a time could start the NavuCdbSubscriber and receive true from this method. Multiple invocations of this method will return false if this NavuCdbSubscriber was already started.
boolean subscriberStop()
ExecutorService
.
If the subscriber is already stopped this method return false.
This makes it possible to restart the Subscriber with
subscriberStart()
.