Class EntityOwnershipUtils
- java.lang.Object
-
- org.opendaylight.genius.utils.clustering.EntityOwnershipUtils
-
public class EntityOwnershipUtils extends java.lang.ObjectEntityOwnershipService utilities.- Author:
- Thomas Pantelis
-
-
Constructor Summary
Constructors Constructor Description EntityOwnershipUtils(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService entityOwnershipService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.opendaylight.mdsal.eos.binding.api.EntityOwnershipServicegetEntityOwnershipService()booleanisEntityOwner(java.lang.String entityType, java.lang.String entityName)Checks if the local node is the owner of an entity.booleanisEntityOwner(org.opendaylight.mdsal.eos.binding.api.Entity entity)Checks if the local node is the owner of an entity.booleanisEntityOwner(org.opendaylight.mdsal.eos.binding.api.Entity entity, long sleepBetweenRetries, int tries)Checks if the local node is the owner of an entity.voidrunOnlyInOwnerNode(java.lang.String entityType, java.lang.String entityName, org.opendaylight.infrautils.jobcoordinator.JobCoordinator coordinator, java.lang.String jobDesc, java.lang.Runnable job)Runs a job task if the local node is the owner of an entity.voidrunOnlyInOwnerNode(java.lang.String entityType, java.lang.String entityName, org.opendaylight.infrautils.jobcoordinator.JobCoordinator coordinator, java.lang.String jobKey, java.lang.String jobDesc, java.util.concurrent.Callable<java.util.List<com.google.common.util.concurrent.ListenableFuture<java.lang.Void>>> job)Runs a job task if the local node is the owner of an entity.
-
-
-
Method Detail
-
getEntityOwnershipService
public org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService getEntityOwnershipService()
-
isEntityOwner
public boolean isEntityOwner(java.lang.String entityType, java.lang.String entityName)Checks if the local node is the owner of an entity.- Parameters:
entityType- the entity typeentityName- the entity name- Returns:
- true is the owner, false otherwise
-
isEntityOwner
public boolean isEntityOwner(org.opendaylight.mdsal.eos.binding.api.Entity entity)
Checks if the local node is the owner of an entity.- Parameters:
entity- the entity- Returns:
- true is the owner, false otherwise
-
isEntityOwner
public boolean isEntityOwner(org.opendaylight.mdsal.eos.binding.api.Entity entity, long sleepBetweenRetries, int tries)Checks if the local node is the owner of an entity.- Parameters:
entity- the entitysleepBetweenRetries- the busy wait interval in millis if the entity is not yet presenttries- the total number of busy wait tries- Returns:
- true is the owner, false otherwise
-
runOnlyInOwnerNode
public void runOnlyInOwnerNode(java.lang.String entityType, java.lang.String entityName, org.opendaylight.infrautils.jobcoordinator.JobCoordinator coordinator, java.lang.String jobDesc, java.lang.Runnable job)Runs a job task if the local node is the owner of an entity.- Parameters:
entityType- the entity typeentityName- the entity namecoordinator- the JobCoordinator on which to run the job taskjobDesc- description of the job for loggingjob- the job task
-
runOnlyInOwnerNode
public void runOnlyInOwnerNode(java.lang.String entityType, java.lang.String entityName, org.opendaylight.infrautils.jobcoordinator.JobCoordinator coordinator, java.lang.String jobKey, java.lang.String jobDesc, java.util.concurrent.Callable<java.util.List<com.google.common.util.concurrent.ListenableFuture<java.lang.Void>>> job)Runs a job task if the local node is the owner of an entity.- Parameters:
entityType- the entity typeentityName- the entity namecoordinator- the JobCoordinator on which to run the jobjobKey- the job keyjobDesc- description of the job for loggingjob- the job task
-
-