Class AkkaEntityOwnershipService
- java.lang.Object
-
- org.opendaylight.controller.eos.akka.AkkaEntityOwnershipService
-
- All Implemented Interfaces:
AutoCloseable
,NativeEosService
,GenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>
,DOMEntityOwnershipService
@Singleton public class AkkaEntityOwnershipService extends Object implements DOMEntityOwnershipService, NativeEosService, AutoCloseable
DOMEntityOwnershipService implementation backed by native Akka clustering constructs. We use distributed-data to track all registered candidates and cluster-singleton to maintain a single cluster-wide authority which selects the appropriate owners.
-
-
Field Summary
Fields Modifier and Type Field Description protected ActorRef<OwnerSupervisorCommand>
ownerSupervisor
-
Constructor Summary
Constructors Modifier Constructor Description protected
AkkaEntityOwnershipService(ActorSystem actorSystem)
AkkaEntityOwnershipService(ActorSystemProvider provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListenableFuture<Void>
activateDataCenter()
Activates the native eos service in the datacenter that this method is called.void
close()
ListenableFuture<Void>
deactivateDataCenter()
Deactivates the native eos service in the datacenter that this method is called.Optional<EntityOwnershipState>
getOwnershipState(DOMEntity entity)
boolean
isCandidateRegistered(DOMEntity forEntity)
DOMEntityOwnershipCandidateRegistration
registerCandidate(DOMEntity entity)
DOMEntityOwnershipListenerRegistration
registerListener(String entityType, DOMEntityOwnershipListener listener)
-
-
-
Field Detail
-
ownerSupervisor
protected final ActorRef<OwnerSupervisorCommand> ownerSupervisor
-
-
Constructor Detail
-
AkkaEntityOwnershipService
protected AkkaEntityOwnershipService(ActorSystem actorSystem) throws ExecutionException, InterruptedException
-
AkkaEntityOwnershipService
@Inject public AkkaEntityOwnershipService(ActorSystemProvider provider) throws ExecutionException, InterruptedException
-
-
Method Detail
-
close
@PreDestroy public void close() throws InterruptedException, ExecutionException
- Specified by:
close
in interfaceAutoCloseable
- Throws:
InterruptedException
ExecutionException
-
registerCandidate
public DOMEntityOwnershipCandidateRegistration registerCandidate(DOMEntity entity) throws CandidateAlreadyRegisteredException
- Specified by:
registerCandidate
in interfaceDOMEntityOwnershipService
- Specified by:
registerCandidate
in interfaceGenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>
- Throws:
CandidateAlreadyRegisteredException
-
registerListener
public DOMEntityOwnershipListenerRegistration registerListener(String entityType, DOMEntityOwnershipListener listener)
- Specified by:
registerListener
in interfaceDOMEntityOwnershipService
- Specified by:
registerListener
in interfaceGenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>
-
getOwnershipState
public Optional<EntityOwnershipState> getOwnershipState(DOMEntity entity)
- Specified by:
getOwnershipState
in interfaceDOMEntityOwnershipService
- Specified by:
getOwnershipState
in interfaceGenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>
-
isCandidateRegistered
public boolean isCandidateRegistered(DOMEntity forEntity)
- Specified by:
isCandidateRegistered
in interfaceDOMEntityOwnershipService
- Specified by:
isCandidateRegistered
in interfaceGenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>
-
activateDataCenter
public ListenableFuture<Void> activateDataCenter()
Description copied from interface:NativeEosService
Activates the native eos service in the datacenter that this method is called.- Specified by:
activateDataCenter
in interfaceNativeEosService
-
deactivateDataCenter
public ListenableFuture<Void> deactivateDataCenter()
Description copied from interface:NativeEosService
Deactivates the native eos service in the datacenter that this method is called.- Specified by:
deactivateDataCenter
in interfaceNativeEosService
-
-