@Deprecated public class NavuCdbConfigSubscriber extends NavuCdbSubscribers implements NavuCdbSubscriber, Runnable
To create a NavuCdbConfigSubscriber
it is preferable to
use the method NavuCdbSubscribers.configSubscriber(String,int)
.
The registration of a configuration path is done through one of its
register
methods.
There can be multiple registrations on a instance of a
NavuCdbConfigSubscriber
. Further the same instance
could be register to handle multiple subscription paths.
A registration of a user provided callback will always have priority set to 1.
This class implements the runnable interface which means that
it will be submitted to the underlying ExecutorService
upon successfully call to subscriberStart()
.
Modifier and Type | Method and Description |
---|---|
NavuCdbSubscriber |
register(NavuCdbDiffIterate cb,
ConfPath path)
Deprecated.
Registers a subscription item onto
the
NavuCdbConfigSubscriber
with a given user provided callback that will be invoked on
Cdb notifications. |
NavuCdbSubscriber |
register(NavuCdbDiffIterate cb,
ConfPath path,
EnumSet<DiffIterateFlags> flags)
Deprecated.
Registers a subscription item onto the
NavuCdbConfigSubscriber
with a given user provided callback that will be invoked on
Cdb notifications. |
NavuCdbSubscriber |
register(NavuCdbDiffIterate cb,
NavuNode node)
Deprecated.
Registers a subscription item onto the
NavuCdbConfigSubscriber
with a given user provided callback that will be invoked on
Cdb notifications. |
NavuCdbSubscriber |
register(NavuCdbDiffIterate cb,
NavuNode node,
EnumSet<DiffIterateFlags> flags)
Deprecated.
Registers a subscription item onto the
NavuCdbConfigSubscriber
with a given user provided callback that will be invoked on
Cdb notifications. |
void |
registerSyncTypeOnException(CdbSubscriptionSyncType syncType)
Deprecated.
When a user callback throws unexpected exception which is not caught
by the application callback the default behavior for a
NavuCdbConfigSubscriber is to sync with
CdbSubscriptionSyncType.DONE_SOCKET and shutdown
the subscriber. |
void |
run()
Deprecated.
The implemented run method that the subscriber thread
will run when started.
|
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 NavuCdbConfigSubscriber asynchronously, submit
this runnable into the underlying ExecutorService if
the NavuCdbConfigSubscriber is not already started.
|
awaitRunning, awaitStopped, configSubscriber, configSubscriber, configSubscriber, configSubscriber, executor, getIterationQueue, isRunning, isStopped, operSubscriber, operSubscriber, operSubscriber, operSubscriber, operSubscriber, registerStoppedHandler, subscriberStop, twoPhaseSubscriber, twoPhaseSubscriber
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
awaitRunning, awaitStopped, executor, getIterationQueue, isRunning, isStopped, registerStoppedHandler, subscriberStop
public NavuCdbSubscriber register(NavuCdbDiffIterate cb, ConfPath path) throws NavuException
NavuCdbConfigSubscriber
with a given user provided callback that will be invoked on
Cdb notifications.
If the keypath does not lead to a configuration node
the method will throw NavuException
and no subscription will
be done on the specified keypath path
.
register
in interface NavuCdbSubscriber
cb
- user provided callback i.e implementation
of NavuCdbConfigDiffIterate
path
- to subscribe to for changesNavuException
- if the path could not be registered with the
NavuCdbConfigSubscriber
. This is caused by erroneous path
i.e if the path does not point to Cdb config data node.public NavuCdbSubscriber register(NavuCdbDiffIterate cb, ConfPath path, EnumSet<DiffIterateFlags> flags) throws NavuException
NavuCdbConfigSubscriber
with a given user provided callback that will be invoked on
Cdb notifications.
If the keypath does not lead to a configuration node
the method will throw NavuException
and no subscription will
be done on the specified keypath path
.
register
in interface NavuCdbSubscriber
cb
- user provided callback i.e implementation
of NavuCdbConfigDiffIterate
path
- to subscribe to for changesflags
- user provided iterate flags for the registered user
callbackNavuException
- if the path could not be registered with the
NavuCdbConfigSubscriber
. This is caused by erroneous path
i.e if the path does not point to Cdb config data node.public NavuCdbSubscriber register(NavuCdbDiffIterate cb, NavuNode node) throws NavuException
NavuCdbConfigSubscriber
with a given user provided callback that will be invoked on
Cdb notifications.
If the NavuNode
does not corresponds to a config data
the method will throw NavuException
and no subscription will
be done on the specified NavuNode
.
register
in interface NavuCdbSubscriber
cb
- user provided callback i.e implementation
of NavuCdbConfigDiffIterate
node
- to subscribe to for changesNavuException
- if the path could not be registered with the
NavuCdbConfigSubscriber
.
This is caused by erroneous path i.e if the path does not point to
Cdb config data node.public NavuCdbSubscriber register(NavuCdbDiffIterate cb, NavuNode node, EnumSet<DiffIterateFlags> flags) throws NavuException
NavuCdbConfigSubscriber
with a given user provided callback that will be invoked on
Cdb notifications.
If the NavuNode
does not corresponds to a config data
the method will throw NavuException
and no subscription will
be done on the specified NavuNode
.
register
in interface NavuCdbSubscriber
cb
- user provided callback i.e implementation
of NavuCdbConfigDiffIterate
node
- to subscribe to for changesflags
- user provided iterate flags for the registered user
callbackNavuException
- if the path could not be registered with the
NavuCdbConfigSubscriber
.This is caused by erroneous path
i.e if the path does not point to Cdb config data node.public void registerSyncTypeOnException(CdbSubscriptionSyncType syncType)
CdbSubscriptionSyncType.DONE_SOCKET
and shutdown
the subscriber.
To change this behavior this method will register a sync type if the above situation occurred.
To change the behavior to NOT stop the subscriber use
( boolean )
set to false.
syncType
- the sync type that will be send to ConfD/NCS
on uncaught exception within application callbackpublic void run()
public void 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.
To change the sync type behavior use
registerSyncTypeOnException(CdbSubscriptionSyncType)
set
to false.
shutDownOnException
in interface NavuCdbSubscriber
shutdownonexc
- true/false whether this subscriber should stop
after a uncaught exception from one of the set of callbacks is thrown.public boolean subscriberStart()
After all the registration have been done the subscriber must be
started which submits this runnable
to the underlying ExecutorService
.
Returns true if this runnable was successfully submitted or false if this NavuCdbConfigSubscriber was already started and this runnable was not submitted successfully.
subscriberStart
in interface NavuCdbSubscriber