Class TransactionLogObserver
- java.lang.Object
- 
- cz.o2.proxima.direct.transaction.manager.TransactionLogObserver
 
- 
- All Implemented Interfaces:
- CommitLogObserver,- LogObserver<Offset,CommitLogObserver.OnNextContext>
 
 @Internal @ThreadSafe @DeclaredThreadSafe public class TransactionLogObserver extends java.lang.Object implements CommitLogObserver ACommitLogObserverperforming the overall transaction logic via keeping state of transactions and responding to requests.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface cz.o2.proxima.direct.core.commitlog.CommitLogObserverCommitLogObserver.OffsetCommitter, CommitLogObserver.OnIdleContext, CommitLogObserver.OnNextContext, CommitLogObserver.OnRepartitionContext
 
- 
 - 
Constructor SummaryConstructors Constructor Description TransactionLogObserver(DirectDataOperator direct, Metrics metrics)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassertSingleton()ServerTransactionManagergetRawManager()booleanonError(java.lang.Throwable error)Called to notify there was anerrorin the commit reader.voidonIdle(CommitLogObserver.OnIdleContext context)Called when the observer is idle.booleanonNext(StreamElement element, CommitLogObserver.OnNextContext context)Process next record in the commit log.voidrun(java.lang.String name)- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface cz.o2.proxima.direct.core.commitlog.CommitLogObserveronRepartition
 - 
Methods inherited from interface cz.o2.proxima.direct.core.LogObserveronCancelled, onCompleted, onException, onFatalError
 
- 
 
- 
- 
- 
Constructor Detail- 
TransactionLogObserverpublic TransactionLogObserver(DirectDataOperator direct, Metrics metrics) 
 
- 
 - 
Method Detail- 
assertSingletonprotected void assertSingleton() 
 - 
onNextpublic boolean onNext(StreamElement element, CommitLogObserver.OnNextContext context) Description copied from interface:LogObserverProcess next record in the commit log.- Specified by:
- onNextin interface- LogObserver<Offset,CommitLogObserver.OnNextContext>
- Parameters:
- element- the element written to the commit log
- context- a context that the application must use to confirm processing of the element. If the application fails to do so, the result is undefined.
- Returns:
- trueif the processing should continue,- falseotherwise
 
 - 
onIdlepublic void onIdle(CommitLogObserver.OnIdleContext context) Description copied from interface:CommitLogObserverCalled when the observer is idle. Note that the definition of idle is commit-log dependent and it even might NOT be called at all, if the commit log guarantees that as long as there are *any* data flowing in, thenLogObserver.onNext(cz.o2.proxima.core.storage.StreamElement, ContextT)will be called eventually.Typical example of commit log with no need to call CommitLogObserver.onIdle(cz.o2.proxima.direct.core.commitlog.CommitLogObserver.OnIdleContext)is google PubSub, having virtually single shared partition which loads balances incoming data.- Specified by:
- onIdlein interface- CommitLogObserver
- Parameters:
- context- the context for on idle processing
 
 - 
onErrorpublic boolean onError(java.lang.Throwable error) Description copied from interface:LogObserverCalled to notify there was anerrorin the commit reader.- Specified by:
- onErrorin interface- LogObserver<Offset,CommitLogObserver.OnNextContext>
- Parameters:
- error- error caught during processing
- Returns:
- trueto restart processing from last committed position,- falseto stop processing
 
 - 
runpublic void run(java.lang.String name) 
 - 
getRawManagerpublic ServerTransactionManager getRawManager() 
 
- 
 
-