Class AkkaEntityOwnershipService
- java.lang.Object
-
- org.opendaylight.controller.eos.akka.AkkaEntityOwnershipService
-
- All Implemented Interfaces:
AutoCloseable,DataCenterControl,GenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>,DOMEntityOwnershipService,OdlEntityOwnersService,RpcService
@Singleton public class AkkaEntityOwnershipService extends Object implements DOMEntityOwnershipService, DataCenterControl, AutoCloseable, OdlEntityOwnersService
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 protectedAkkaEntityOwnershipService(ActorSystem actorSystem, BindingCodecTree codecTree)AkkaEntityOwnershipService(ActorSystemProvider actorProvider, RpcProviderService rpcProvider, BindingCodecTree codecTree)
-
Method Summary
-
-
-
Field Detail
-
ownerSupervisor
protected final ActorRef<OwnerSupervisorCommand> ownerSupervisor
-
-
Constructor Detail
-
AkkaEntityOwnershipService
protected AkkaEntityOwnershipService(ActorSystem actorSystem, BindingCodecTree codecTree) throws ExecutionException, InterruptedException
-
AkkaEntityOwnershipService
@Inject public AkkaEntityOwnershipService(ActorSystemProvider actorProvider, RpcProviderService rpcProvider, BindingCodecTree codecTree) throws ExecutionException, InterruptedException
-
-
Method Detail
-
close
@PreDestroy public void close() throws InterruptedException, ExecutionException- Specified by:
closein interfaceAutoCloseable- Throws:
InterruptedExceptionExecutionException
-
registerCandidate
public DOMEntityOwnershipCandidateRegistration registerCandidate(DOMEntity entity) throws CandidateAlreadyRegisteredException
- Specified by:
registerCandidatein interfaceDOMEntityOwnershipService- Specified by:
registerCandidatein interfaceGenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>- Throws:
CandidateAlreadyRegisteredException
-
registerListener
public DOMEntityOwnershipListenerRegistration registerListener(String entityType, DOMEntityOwnershipListener listener)
- Specified by:
registerListenerin interfaceDOMEntityOwnershipService- Specified by:
registerListenerin interfaceGenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>
-
getOwnershipState
public Optional<EntityOwnershipState> getOwnershipState(DOMEntity entity)
- Specified by:
getOwnershipStatein interfaceDOMEntityOwnershipService- Specified by:
getOwnershipStatein interfaceGenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>
-
isCandidateRegistered
public boolean isCandidateRegistered(DOMEntity forEntity)
- Specified by:
isCandidateRegisteredin interfaceDOMEntityOwnershipService- Specified by:
isCandidateRegisteredin interfaceGenericEntityOwnershipService<YangInstanceIdentifier,DOMEntity,DOMEntityOwnershipListener>
-
activateDataCenter
public ListenableFuture<Empty> activateDataCenter()
Description copied from interface:DataCenterControlActivates the Entity Ownership Service in the datacenter that this method is called.- Specified by:
activateDataCenterin interfaceDataCenterControl- Returns:
- Completion future
-
deactivateDataCenter
public ListenableFuture<Empty> deactivateDataCenter()
Description copied from interface:DataCenterControlDeactivates the Entity Ownership Service in the datacenter that this method is called.- Specified by:
deactivateDataCenterin interfaceDataCenterControl- Returns:
- Completion future
-
getEntities
public ListenableFuture<RpcResult<GetEntitiesOutput>> getEntities(GetEntitiesInput input)
Description copied from interface:OdlEntityOwnersServiceInvokeget-entitiesRPC.- Specified by:
getEntitiesin interfaceOdlEntityOwnersService- Parameters:
input- ofget-entities- Returns:
- output of
get-entities
-
getEntity
public ListenableFuture<RpcResult<GetEntityOutput>> getEntity(GetEntityInput input)
Description copied from interface:OdlEntityOwnersServiceInvokeget-entityRPC.- Specified by:
getEntityin interfaceOdlEntityOwnersService- Parameters:
input- ofget-entity- Returns:
- output of
get-entity
-
getEntityOwner
public ListenableFuture<RpcResult<GetEntityOwnerOutput>> getEntityOwner(GetEntityOwnerInput input)
Description copied from interface:OdlEntityOwnersServiceInvokeget-entity-ownerRPC.- Specified by:
getEntityOwnerin interfaceOdlEntityOwnersService- Parameters:
input- ofget-entity-owner- Returns:
- output of
get-entity-owner
-
-