SDN Controller Programming Guide
75
List<LockNameType> lockNames = new ArrayList<LockNameType>();
lockNames.add(new LockNameType(LockType.READ_LOCK, appName, "KEY1"));
lockNames.add(new LockNameType(LockType.WRITE_LOCK,
appName, "KEY3"));
// MultiLock name should be unique. While constructing the name,
// its suggested to prefix application instance id
multiLock = haService.createMultiLock(
id, new LockName(appName, "MultiLock"), lockNames);
try {
boolean lockAcquired = multiLock.tryLock(
10, TimeUnit.MILLISECONDS);
if (true == lockAcquired)
multiLock.unlock();
...
multiLock.lock();
multiLock.unlock();
...
haService.deleteLock(multiLock);
} catch (Exception e) {
...
}
}
private void lockQueryOperations() {
try {
List<LockName> lockNameList = new ArrayList<LockName>();
lockNameList.add(new LockName(appName));
List<Lock> locks = haService.getAppLocks(lockNameList, id);
} catch (Exception e) {
...
}
}
}
High Availability
Role orchestration
Role Orchestration Service provides a federated mechanism to define the role of teamed
controllers with respect to the network elements in the controlled domain. The role that a controller
assumes in relation to a network element would determine whether it has abilities to write and
modify the configurations on the network element, or has only read-only access to it.