use of org.apache.asterix.common.api.INcApplicationContext in project asterixdb by apache.
the class JobEventListenerFactory method createListener.
@Override
public IJobletEventListener createListener(final IHyracksJobletContext jobletContext) {
return new IJobletEventListener() {
@Override
public void jobletFinish(JobStatus jobStatus) {
try {
ITransactionManager txnManager = ((INcApplicationContext) jobletContext.getServiceContext().getApplicationContext()).getTransactionSubsystem().getTransactionManager();
ITransactionContext txnContext = txnManager.getTransactionContext(jobId, false);
txnContext.setWriteTxn(transactionalWrite);
txnManager.completedTransaction(txnContext, DatasetId.NULL, -1, !(jobStatus == JobStatus.FAILURE));
} catch (ACIDException e) {
throw new Error(e);
}
}
@Override
public void jobletStart() {
try {
((INcApplicationContext) jobletContext.getServiceContext().getApplicationContext()).getTransactionSubsystem().getTransactionManager().getTransactionContext(jobId, true);
} catch (ACIDException e) {
throw new Error(e);
}
}
};
}
use of org.apache.asterix.common.api.INcApplicationContext in project asterixdb by apache.
the class FeedIntakeOperatorDescriptor method createExternalAdapterFactory.
private IAdapterFactory createExternalAdapterFactory(IHyracksTaskContext ctx) throws HyracksDataException {
IAdapterFactory adapterFactory;
INcApplicationContext runtimeCtx = (INcApplicationContext) ctx.getJobletContext().getServiceContext().getApplicationContext();
ILibraryManager libraryManager = runtimeCtx.getLibraryManager();
ClassLoader classLoader = libraryManager.getLibraryClassLoader(feedId.getDataverse(), adaptorLibraryName);
if (classLoader != null) {
try {
adapterFactory = (IAdapterFactory) (classLoader.loadClass(adaptorFactoryClassName).newInstance());
adapterFactory.setOutputType(adapterOutputType);
adapterFactory.configure(ctx.getJobletContext().getServiceContext(), adaptorConfiguration);
} catch (Exception e) {
throw new HyracksDataException(e);
}
} else {
RuntimeDataException err = new RuntimeDataException(ErrorCode.OPERATORS_FEED_INTAKE_OPERATOR_DESCRIPTOR_CLASSLOADER_NOT_CONFIGURED, adaptorLibraryName, feedId.getDataverse());
LOGGER.severe(err.getMessage());
throw err;
}
return adapterFactory;
}
use of org.apache.asterix.common.api.INcApplicationContext in project asterixdb by apache.
the class CheckpointTask method perform.
@Override
public void perform(IControllerService cs) throws HyracksDataException {
INcApplicationContext appContext = (INcApplicationContext) cs.getApplicationContext();
ICheckpointManager checkpointMgr = appContext.getTransactionSubsystem().getCheckpointManager();
checkpointMgr.doSharpCheckpoint();
}
use of org.apache.asterix.common.api.INcApplicationContext in project asterixdb by apache.
the class RemoteRecoveryTask method perform.
@Override
public void perform(IControllerService cs) throws HyracksDataException {
INcApplicationContext appContext = (INcApplicationContext) cs.getApplicationContext();
appContext.getRemoteRecoveryManager().doRemoteRecoveryPlan(recoveryPlan);
}
use of org.apache.asterix.common.api.INcApplicationContext in project asterixdb by apache.
the class StartFailbackTask method perform.
@Override
public void perform(IControllerService cs) throws HyracksDataException {
INcApplicationContext appContext = (INcApplicationContext) cs.getApplicationContext();
appContext.getRemoteRecoveryManager().startFailbackProcess();
}
Aggregations