use of org.apache.asterix.common.transactions.IResourceIdManager in project asterixdb by apache.
the class ResourceIdRequestMessage method handle.
@Override
public void handle(ICcApplicationContext appCtx) throws HyracksDataException, InterruptedException {
try {
ICCMessageBroker broker = (ICCMessageBroker) appCtx.getServiceContext().getMessageBroker();
ResourceIdRequestResponseMessage reponse = new ResourceIdRequestResponseMessage();
if (!ClusterStateManager.INSTANCE.isClusterActive()) {
reponse.setResourceId(-1);
reponse.setException(new Exception("Cannot generate global resource id when cluster is not active."));
} else {
IResourceIdManager resourceIdManager = appCtx.getResourceIdManager();
reponse.setResourceId(resourceIdManager.createResourceId());
if (reponse.getResourceId() < 0) {
reponse.setException(new Exception("One or more nodes has not reported max resource id."));
}
requestMaxResourceID(resourceIdManager, broker);
}
broker.sendApplicationMessageToNC(reponse, src);
} catch (Exception e) {
throw HyracksDataException.create(e);
}
}
use of org.apache.asterix.common.transactions.IResourceIdManager in project asterixdb by apache.
the class ReportMaxResourceIdMessage method handle.
@Override
public void handle(ICcApplicationContext appCtx) throws HyracksDataException, InterruptedException {
IResourceIdManager resourceIdManager = appCtx.getResourceIdManager();
resourceIdManager.report(src, maxResourceId);
}
Aggregations