use of com.emc.storageos.coordinator.exceptions.CoordinatorException in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method commitTransaction.
@Override
public void commitTransaction() throws CoordinatorException {
try {
CuratorTransaction handler = zkTransactionHandler.get();
CuratorTransactionFinal tx = (CuratorTransactionFinal) handler;
tx.commit();
zkTransactionHandler.remove();
} catch (Exception ex) {
throw CoordinatorException.fatals.unableToPersistTheConfiguration(ex);
}
}
use of com.emc.storageos.coordinator.exceptions.CoordinatorException in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method removeServiceConfiguration.
@Override
public void removeServiceConfiguration(String siteId, Configuration... configs) throws CoordinatorException {
for (int i = 0; i < configs.length; i++) {
Configuration config = configs[i];
String prefix = "";
if (siteId != null) {
prefix = getSitePrefix(siteId);
}
String servicePath = String.format("%1$s%2$s/%3$s/%4$s", prefix, ZkPath.CONFIG, config.getKind(), config.getId());
try {
CuratorTransaction handler = zkTransactionHandler.get();
if (handler != null) {
CuratorTransactionFinal tx = handler.delete().forPath(servicePath).and();
zkTransactionHandler.set(tx);
} else {
_zkConnection.curator().delete().forPath(servicePath);
}
} catch (KeeperException.NoNodeException ignore) {
// Ignore exception, don't re-throw
log.debug("Caught exception but ignoring it: " + ignore);
} catch (Exception e) {
throw CoordinatorException.fatals.unableToRemoveConfiguration(config.getId(), e);
}
}
}
use of com.emc.storageos.coordinator.exceptions.CoordinatorException in project coprhd-controller by CoprHD.
the class WorkPoolImpl method start.
@Override
public synchronized void start() throws CoordinatorException {
// setup group, lock, and item paths
EnsurePath path = new EnsurePath(_workItemPath);
try {
path.ensure(_zkClient.getZookeeperClient());
path = new EnsurePath(_workItemLockPath);
path.ensure(_zkClient.getZookeeperClient());
} catch (Exception e) {
throw CoordinatorException.retryables.unableToStartWork(_workItemPath, e);
}
// add listeners
_zkClient.getConnectionStateListenable().addListener(_connectionStateListener);
_zkClient.getCuratorListenable().addListener(_changeWatcher);
// prime assignment loop
refresh();
}
use of com.emc.storageos.coordinator.exceptions.CoordinatorException in project coprhd-controller by CoprHD.
the class LoggingMBean method persistLogLevel.
private void persistLogLevel(String level, int expirInMin, String scope) {
ConfigurationImpl config = new ConfigurationImpl();
config.setKind(_logName);
config.setId(_hostId);
long expiration = System.currentTimeMillis() + expirInMin * 60 * 1000;
String configStr = level + LOG_LEVEL_DELIMITER + String.valueOf(expiration) + LOG_LEVEL_DELIMITER + scope;
config.setConfig(LOG_LEVEL_CONFIG, configStr);
try {
_log.info("Persisting log level configuration");
_coordinator.persistServiceConfiguration(config);
_log.info("Persist log level configuration succeed");
} catch (CoordinatorException e) {
_log.error("Exception persisting log level config {}:", configStr, e);
return;
}
}
Aggregations