本文整理了Java中org.apache.hyracks.api.context.IHyracksJobletContext.getJobletEventListenerFactory()
方法的一些代码示例,展示了IHyracksJobletContext.getJobletEventListenerFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IHyracksJobletContext.getJobletEventListenerFactory()
方法的具体详情如下:
包路径:org.apache.hyracks.api.context.IHyracksJobletContext
类名称:IHyracksJobletContext
方法名:getJobletEventListenerFactory
暂无
代码示例来源:origin: apache/asterixdb
@Override
public IPushRuntime[] createPushRuntime(IHyracksTaskContext ctx) throws HyracksDataException {
IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory();
return new IPushRuntime[] { new CommitRuntime(ctx, ((IJobEventListenerFactory) fact).getTxnId(datasetId),
datasetId, primaryKeyFields, isWriteTransaction,
datasetPartitions[ctx.getTaskAttemptId().getTaskId().getPartition()], isSink) };
}
}
代码示例来源:origin: apache/asterixdb
@Override
public LockThenSearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx,
IOperatorNodePushable operatorNodePushable) throws HyracksDataException {
ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
try {
IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory();
ITransactionContext txnCtx = txnSubsystem.getTransactionManager()
.getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId));
return new LockThenSearchOperationCallback(new DatasetId(datasetId), resourceId, primaryKeyFields,
txnSubsystem, txnCtx, operatorNodePushable);
} catch (ACIDException e) {
throw HyracksDataException.create(e);
}
}
代码示例来源:origin: apache/asterixdb
@Override
public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx,
IOperatorNodePushable operatorNodePushable) throws HyracksDataException {
ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
try {
IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory();
ITransactionContext txnCtx = txnSubsystem.getTransactionManager()
.getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId));
return new PrimaryIndexInstantSearchOperationCallback(new DatasetId(datasetId), resourceId,
primaryKeyFields, txnSubsystem.getLockManager(), txnCtx);
} catch (ACIDException e) {
throw HyracksDataException.create(e);
}
}
代码示例来源:origin: apache/asterixdb
@Override
public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx,
IOperatorNodePushable operatorNodePushable) throws HyracksDataException {
ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
try {
IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory();
ITransactionContext txnCtx = txnSubsystem.getTransactionManager()
.getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId));
return new PrimaryIndexSearchOperationCallback(new DatasetId(datasetId), resourceId, primaryKeyFields,
txnSubsystem.getLockManager(), txnCtx);
} catch (ACIDException e) {
throw HyracksDataException.create(e);
}
}
代码示例来源:origin: apache/asterixdb
public IHyracksTaskContext createTestContext(JobId jobId, int partition, boolean withMessaging)
throws HyracksDataException {
IHyracksTaskContext ctx = TestUtils.create(KB32, ExecutionTestUtil.integrationUtil.ncs[0].getIoManager());
if (withMessaging) {
TaskUtil.put(HyracksConstants.KEY_MESSAGE, new VSizeFrame(ctx), ctx);
}
IHyracksJobletContext jobletCtx = Mockito.mock(IHyracksJobletContext.class);
JobEventListenerFactory factory = new JobEventListenerFactory(new TxnId(jobId.getId()), true);
Mockito.when(jobletCtx.getJobletEventListenerFactory()).thenReturn(factory);
Mockito.when(jobletCtx.getServiceContext()).thenReturn(ExecutionTestUtil.integrationUtil.ncs[0].getContext());
Mockito.when(jobletCtx.getJobId()).thenReturn(jobId);
ctx = Mockito.spy(ctx);
Mockito.when(ctx.getJobletContext()).thenReturn(jobletCtx);
Mockito.when(ctx.getIoManager()).thenReturn(ExecutionTestUtil.integrationUtil.ncs[0].getIoManager());
TaskAttemptId taskId =
new TaskAttemptId(new TaskId(new ActivityId(new OperatorDescriptorId(0), 0), partition), 0);
Mockito.when(ctx.getTaskAttemptId()).thenReturn(taskId);
return ctx;
}
代码示例来源:origin: apache/asterixdb
@Override
public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx,
IOperatorNodePushable operatorNodePushable) throws HyracksDataException {
try {
// If the plan is an index-only query plan, we need to try to get an instant try lock on PK.
// If an instant tryLock on PK fails, we do not attempt to do a lock since the operations
// will be dealt with in the operators after the given secondary-index search.
ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory();
ITransactionContext txnCtx = txnSubsystem.getTransactionManager()
.getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId));
return new SecondaryIndexInstantSearchOperationCallback(new DatasetId(datasetId), resourceId,
primaryKeyFields, txnSubsystem.getLockManager(), txnCtx);
} catch (ACIDException e) {
throw HyracksDataException.create(e);
}
}
}
代码示例来源:origin: apache/asterixdb
@Override
public IModificationOperationCallback createModificationOperationCallback(LocalResource resource,
IHyracksTaskContext ctx, IOperatorNodePushable operatorNodePushable) throws HyracksDataException {
ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
IResourceLifecycleManager<IIndex> indexLifeCycleManager =
txnSubsystem.getApplicationContext().getDatasetLifecycleManager();
ILSMIndex index = (ILSMIndex) indexLifeCycleManager.get(resource.getPath());
if (index == null) {
throw new HyracksDataException("Index(id:" + resource.getId() + ") is not registered.");
}
try {
IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory();
ITransactionContext txnCtx = txnSubsystem.getTransactionManager()
.getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId));
DatasetLocalResource aResource = (DatasetLocalResource) resource.getResource();
IModificationOperationCallback modCallback = new PrimaryIndexModificationOperationCallback(
new DatasetId(datasetId), primaryKeyFields, txnCtx, txnSubsystem.getLockManager(), txnSubsystem,
resource.getId(), aResource.getPartition(), resourceType, indexOp, operatorNodePushable);
txnCtx.register(resource.getId(), aResource.getPartition(), index, modCallback, true);
return modCallback;
} catch (ACIDException e) {
throw HyracksDataException.create(e);
}
}
}
代码示例来源:origin: apache/asterixdb
@Override
public IModificationOperationCallback createModificationOperationCallback(LocalResource resource,
IHyracksTaskContext ctx, IOperatorNodePushable operatorNodePushable) throws HyracksDataException {
DatasetLocalResource aResource = (DatasetLocalResource) resource.getResource();
ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
IResourceLifecycleManager indexLifeCycleManager =
txnSubsystem.getApplicationContext().getDatasetLifecycleManager();
ILSMIndex index = (ILSMIndex) indexLifeCycleManager.get(resource.getPath());
if (index == null) {
throw new HyracksDataException("Index(id:" + resource.getId() + ") is not registered.");
}
try {
IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory();
ITransactionContext txnCtx = txnSubsystem.getTransactionManager()
.getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId));
IModificationOperationCallback modCallback = new UpsertOperationCallback(new DatasetId(datasetId),
primaryKeyFields, txnCtx, txnSubsystem.getLockManager(), txnSubsystem, resource.getId(),
aResource.getPartition(), resourceType, indexOp);
txnCtx.register(resource.getId(), aResource.getPartition(), index, modCallback, true);
return modCallback;
} catch (ACIDException e) {
throw HyracksDataException.create(e);
}
}
}
代码示例来源:origin: apache/asterixdb
@Override
public IModificationOperationCallback createModificationOperationCallback(LocalResource resource,
IHyracksTaskContext ctx, IOperatorNodePushable operatorNodePushable) throws HyracksDataException {
ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
IResourceLifecycleManager indexLifeCycleManager =
txnSubsystem.getApplicationContext().getDatasetLifecycleManager();
ILSMIndex index = (ILSMIndex) indexLifeCycleManager.get(resource.getPath());
if (index == null) {
throw new HyracksDataException("Index(id:" + resource.getId() + ") is not registered.");
}
try {
IJobletEventListenerFactory fact = ctx.getJobletContext().getJobletEventListenerFactory();
ITransactionContext txnCtx = txnSubsystem.getTransactionManager()
.getTransactionContext(((IJobEventListenerFactory) fact).getTxnId(datasetId));
DatasetLocalResource aResource = (DatasetLocalResource) resource.getResource();
IModificationOperationCallback modCallback = new SecondaryIndexModificationOperationCallback(
new DatasetId(datasetId), primaryKeyFields, txnCtx, txnSubsystem.getLockManager(), txnSubsystem,
resource.getId(), aResource.getPartition(), resourceType, indexOp);
txnCtx.register(resource.getId(), aResource.getPartition(), index, modCallback, false);
return modCallback;
} catch (ACIDException e) {
throw HyracksDataException.create(e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!