本文整理汇总了Java中org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState.isOwner方法的典型用法代码示例。如果您正苦于以下问题:Java EntityOwnershipState.isOwner方法的具体用法?Java EntityOwnershipState.isOwner怎么用?Java EntityOwnershipState.isOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState
的用法示例。
在下文中一共展示了EntityOwnershipState.isOwner方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerEntityForOwnership
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState; //导入方法依赖的package包/类
private void registerEntityForOwnership(OvsdbConnectionInstance ovsdbConnectionInstance) {
Entity candidateEntity = getEntityFromConnectionInstance(ovsdbConnectionInstance);
entityConnectionMap.put(candidateEntity, ovsdbConnectionInstance);
ovsdbConnectionInstance.setConnectedEntity(candidateEntity);
try {
EntityOwnershipCandidateRegistration registration =
entityOwnershipService.registerCandidate(candidateEntity);
ovsdbConnectionInstance.setDeviceOwnershipCandidateRegistration(registration);
LOG.info("OVSDB entity {} is registered for ownership.", candidateEntity);
//If entity already has owner, it won't get notification from EntityOwnershipService
//so cache the connection instances.
Optional<EntityOwnershipState> ownershipStateOpt =
entityOwnershipService.getOwnershipState(candidateEntity);
if (ownershipStateOpt.isPresent()) {
EntityOwnershipState ownershipState = ownershipStateOpt.get();
if (ownershipState.hasOwner() && !ownershipState.isOwner()) {
LOG.info("OVSDB entity {} is already owned by other southbound plugin "
+ "instance, so *this* instance is NOT an OWNER of the device",
ovsdbConnectionInstance.getConnectionInfo());
putConnectionInstance(ovsdbConnectionInstance.getMDConnectionInfo(),ovsdbConnectionInstance);
}
}
} catch (CandidateAlreadyRegisteredException e) {
LOG.warn("OVSDB entity {} was already registered for ownership", candidateEntity, e);
}
}
示例2: init
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState; //导入方法依赖的package包/类
/**
* Used by blueprint when starting the container.
*/
public void init() {
LOG.info("SouthboundProvider Session Initiated");
this.txInvoker = new TransactionInvokerImpl(db);
cm = new OvsdbConnectionManager(db,txInvoker,entityOwnershipService, ovsdbConnection, instanceIdentifierCodec);
ovsdbDataTreeChangeListener = new OvsdbDataTreeChangeListener(db, cm, instanceIdentifierCodec);
//Register listener for entityOnwership changes
providerOwnershipChangeListener =
new SouthboundPluginInstanceEntityOwnershipListener(this,this.entityOwnershipService);
//register instance entity to get the ownership of the provider
Entity instanceEntity = new Entity(ENTITY_TYPE, ENTITY_TYPE);
try {
Optional<EntityOwnershipState> ownershipStateOpt = entityOwnershipService.getOwnershipState(instanceEntity);
registration = entityOwnershipService.registerCandidate(instanceEntity);
if (ownershipStateOpt.isPresent()) {
EntityOwnershipState ownershipState = ownershipStateOpt.get();
if (ownershipState.hasOwner() && !ownershipState.isOwner()) {
ovsdbConnection.registerConnectionListener(cm);
ovsdbConnection.startOvsdbManager();
LOG.info("*This* instance of OVSDB southbound provider is set as a SLAVE instance");
}
}
} catch (CandidateAlreadyRegisteredException e) {
LOG.warn("OVSDB Southbound Provider instance entity {} was already "
+ "registered for ownership", instanceEntity, e);
}
}
示例3: init
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState; //导入方法依赖的package包/类
/**
* Used by blueprint when starting the container.
*/
public void init() {
LOG.info("HwvtepSouthboundProvider Session Initiated");
txInvoker = new TransactionInvokerImpl(db);
cm = new HwvtepConnectionManager(db, txInvoker, entityOwnershipService);
hwvtepDTListener = new HwvtepDataChangeListener(db, cm);
hwvtepReconciliationManager = new HwvtepReconciliationManager(db, cm);
//Register listener for entityOnwership changes
providerOwnershipChangeListener =
new HwvtepsbPluginInstanceEntityOwnershipListener(this,this.entityOwnershipService);
//register instance entity to get the ownership of the provider
Entity instanceEntity = new Entity(ENTITY_TYPE, ENTITY_TYPE);
try {
Optional<EntityOwnershipState> ownershipStateOpt = entityOwnershipService.getOwnershipState(instanceEntity);
registration = entityOwnershipService.registerCandidate(instanceEntity);
if (ownershipStateOpt.isPresent()) {
EntityOwnershipState ownershipState = ownershipStateOpt.get();
if (ownershipState.hasOwner() && !ownershipState.isOwner()) {
ovsdbConnection.registerConnectionListener(cm);
ovsdbConnection.startOvsdbManager();
}
}
} catch (CandidateAlreadyRegisteredException e) {
LOG.warn("HWVTEP Southbound Provider instance entity {} was already "
+ "registered for ownership", instanceEntity, e);
}
}
示例4: registerEntityForOwnership
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState; //导入方法依赖的package包/类
private void registerEntityForOwnership(HwvtepConnectionInstance hwvtepConnectionInstance) {
Entity candidateEntity = getEntityFromConnectionInstance(hwvtepConnectionInstance);
entityConnectionMap.put(candidateEntity, hwvtepConnectionInstance);
hwvtepConnectionInstance.setConnectedEntity(candidateEntity);
try {
EntityOwnershipCandidateRegistration registration =
entityOwnershipService.registerCandidate(candidateEntity);
hwvtepConnectionInstance.setDeviceOwnershipCandidateRegistration(registration);
LOG.info("HWVTEP entity {} is registered for ownership.", candidateEntity);
//If entity already has owner, it won't get notification from EntityOwnershipService
//so cache the connection instances.
Optional<EntityOwnershipState> ownershipStateOpt =
entityOwnershipService.getOwnershipState(candidateEntity);
if (ownershipStateOpt.isPresent()) {
EntityOwnershipState ownershipState = ownershipStateOpt.get();
if (ownershipState.hasOwner() && !ownershipState.isOwner()) {
if (getConnectionInstance(hwvtepConnectionInstance.getMDConnectionInfo()) != null) {
LOG.info("OVSDB entity {} is already owned by other southbound plugin "
+ "instance, so *this* instance is NOT an OWNER of the device",
hwvtepConnectionInstance.getConnectionInfo());
putConnectionInstance(hwvtepConnectionInstance.getMDConnectionInfo(),hwvtepConnectionInstance);
}
}
}
} catch (CandidateAlreadyRegisteredException e) {
LOG.warn("OVSDB entity {} was already registered for ownership", candidateEntity, e);
}
}