P
- the instance identifier path typeE
- the GenericEntity typeC
- the GenericEntityOwnershipChange typeG
- the GenericEntityOwnershipListener typeS
- the GenericEntityOwnershipService typeR
- the GenericEntityOwnershipListenerRegistration typepublic abstract class AbstractClusterSingletonServiceProviderImpl<P extends org.opendaylight.yangtools.concepts.Path<P>,E extends GenericEntity<P>,C extends GenericEntityOwnershipChange<P,E>,G extends GenericEntityOwnershipListener<P,C>,S extends GenericEntityOwnershipService<P,E,G>,R extends GenericEntityOwnershipListenerRegistration<P,G>> extends Object implements ClusterSingletonServiceProvider, GenericEntityOwnershipListener<P,C>
AbstractClusterSingletonServiceProviderImpl
represents implementations of
ClusterSingletonServiceProvider
and it implements GenericEntityOwnershipListener
for providing OwnershipChange for all registered ClusterSingletonServiceGroup
entity
candidate.Modifier | Constructor and Description |
---|---|
protected |
AbstractClusterSingletonServiceProviderImpl(S entityOwnershipService)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected abstract E |
createEntity(String entityType,
String entityIdentifier)
Creates an extended
GenericEntity instance. |
protected abstract String |
getServiceIdentifierFromEntity(E entity)
Method is responsible for parsing ServiceGroupIdentifier from E entity.
|
void |
initializeProvider()
This method must be called once on startup to initialize this provider.
|
void |
ownershipChanged(C ownershipChange)
A notification that is generated when the ownership status of an entity changes.
|
ClusterSingletonServiceRegistration |
registerClusterSingletonService(ClusterSingletonService service)
Method registers
ClusterSingletonService to Provider. |
protected abstract R |
registerListener(String entityType,
S entityOwnershipServiceInst)
Method implementation registers a defined
GenericEntityOwnershipListenerRegistration type
EntityOwnershipListenerRegistration. |
protected AbstractClusterSingletonServiceProviderImpl(S entityOwnershipService)
entityOwnershipService
- relevant EOSpublic final void initializeProvider()
public final ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service)
ClusterSingletonServiceProvider
ClusterSingletonService
to Provider.
Method returns RuntimeException
for unexpected state, so be careful with implementation.
Note: RuntimeException is implemented as a notification about some problems with registration and client
has to implement some strategy for handling this issue.
TODO: RuntimeException is not a transparent contract for handling unexpected state and it needs to be
replaced with a specific documented Exception or it needs to add another contract definition for a client
notification about the unexpected state reason in ClusterSingletonService
.
RuntimeException implementation is a hotfix for an unwanted API contract changes in boron release only.registerClusterSingletonService
in interface ClusterSingletonServiceProvider
service
- ClusterSingletonService instanceAutoCloseable
registrationpublic final void close()
close
in interface AutoCloseable
public final void ownershipChanged(C ownershipChange)
GenericEntityOwnershipListener
ownershipChanged
in interface GenericEntityOwnershipListener<P extends org.opendaylight.yangtools.concepts.Path<P>,C extends GenericEntityOwnershipChange<P,E>>
ownershipChange
- contains the entity and its ownership change stateprotected abstract R registerListener(String entityType, S entityOwnershipServiceInst)
GenericEntityOwnershipListenerRegistration
type
EntityOwnershipListenerRegistration.entityType
- the type of the entityentityOwnershipServiceInst
- - EOS typeprotected abstract E createEntity(String entityType, String entityIdentifier)
GenericEntity
instance.entityType
- the type of the entityentityIdentifier
- the identifier of the entityCopyright © 2019 OpenDaylight. All rights reserved.