Search in sources :

Example 1 with UnlockOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockOutput in project netvirt by opendaylight.

the class VpnUtil method unlockSubnet.

// We store the cause, which is what we really care about
@SuppressWarnings("checkstyle:AvoidHidingCauseException")
public void unlockSubnet(String subnetId) {
    UnlockInput input = new UnlockInputBuilder().setLockName(subnetId).build();
    Future<RpcResult<UnlockOutput>> result = lockManager.unlock(input);
    try {
        if (result != null && result.get().isSuccessful()) {
            LOG.debug("unlockSubnet: Unlocked {}", subnetId);
        } else {
            LOG.debug("unlockSubnet: Unable to unlock subnet {}", subnetId);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("unlockSubnet: Unable to unlock subnet {}", subnetId);
        throw new RuntimeException(String.format("Unable to unlock subnetId %s", subnetId), e.getCause());
    }
}
Also used : UnlockInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) UnlockInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInputBuilder) ExecutionException(java.util.concurrent.ExecutionException)

Example 2 with UnlockOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockOutput in project netvirt by opendaylight.

the class FibUtil method unlockCluster.

public static void unlockCluster(LockManagerService lockManager, String lockName) {
    UnlockInput input = new UnlockInputBuilder().setLockName(lockName).build();
    Future<RpcResult<UnlockOutput>> result = lockManager.unlock(input);
    try {
        if (result != null && result.get().isSuccessful()) {
            LOG.debug("unlockCluster: Unlocked {}", lockName);
        } else {
            LOG.error("unlockCluster: Unable to release lock for {}", lockName);
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("unlockCluster: Unable to unlock {}", lockName, e);
    }
}
Also used : UnlockInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) UnlockInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInputBuilder) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)2 UnlockInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInput)2 UnlockInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.UnlockInputBuilder)2 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)2