@Override public void finishBatch(ProcessorContext processorContext) { _collector.setContext(processorContext); Object batchId = processorContext.batchId; // since this processor type is a committer, this occurs in the commit phase List<TridentTuple> buffer = (List) processorContext.state[_context.getStateIndex()]; // don't update unless there are tuples // this helps out with things like global partition persist, where multiple tasks may still // exist for this processor. Only want the global one to do anything // this is also a helpful optimization that state implementations don't need to manually do if (buffer.size() > 0) { Long txid = null; // this is to support things like persisting off of drpc stream, which is inherently unreliable // and won't have a tx attempt if (batchId instanceof TransactionAttempt) { txid = ((TransactionAttempt) batchId).getTransactionId(); } _state.beginCommit(txid); _updater.updateState(_state, buffer, _collector); _state.commit(txid); } }
@Override public void finishBatch(ProcessorContext processorContext) { _collector.setContext(processorContext); Object batchId = processorContext.batchId; // since this processor type is a committer, this occurs in the commit phase List<TridentTuple> buffer = (List) processorContext.state[_context.getStateIndex()]; // don't update unless there are tuples // this helps out with things like global partition persist, where multiple tasks may still // exist for this processor. Only want the global one to do anything // this is also a helpful optimization that state implementations don't need to manually do if(buffer.size() > 0) { Long txid = null; // this is to support things like persisting off of drpc stream, which is inherently unreliable // and won't have a tx attempt if(batchId instanceof TransactionAttempt) { txid = ((TransactionAttempt) batchId).getTransactionId(); } _state.beginCommit(txid); _updater.updateState(_state, buffer, _collector); _state.commit(txid); } }