public static interface HollowProducer.WriteState
extends java.lang.AutoCloseable
Modifier and Type | Method and Description |
---|---|
int |
add(java.lang.Object o)
Adds the specified POJO to the state engine.
|
void |
close()
Closes this write state making it inoperable.
|
HollowObjectMapper |
getObjectMapper()
For advanced use-cases, access the underlying
HollowObjectMapper . |
HollowProducer.ReadState |
getPriorState()
For advanced use-cases, access the ReadState of the prior successful cycle.
|
HollowWriteStateEngine |
getStateEngine()
For advanced use-cases, access the underlying
HollowWriteStateEngine . |
long |
getVersion()
Returns the version of the current producer cycle being populated.
|
int add(java.lang.Object o) throws java.lang.IllegalStateException
HollowObjectMapper.add(Object)
for details.
Calling this method after the producer's populate stage has completed is an error.
o
- the POJO to addjava.lang.IllegalStateException
- if called after the populate stage has completed (see
HollowProducer.Populator
for details on the contract)HollowObjectMapper getObjectMapper() throws java.lang.IllegalStateException
HollowObjectMapper
. Prefer using add(Object)
on this class instead.
Calling this method after the producer's populate stage has completed is an error. Exercise caution when
saving the returned reference in a local variable that is closed over by an asynchronous task as that
circumvents this guard. It is safest to call writeState.getObjectMapper()
within the closure.
java.lang.IllegalStateException
- if called after the populate stage has completed (see
HollowProducer.Populator
for details on the contract)HollowWriteStateEngine getStateEngine() throws java.lang.IllegalStateException
HollowWriteStateEngine
. Prefer using
add(Object)
on this class instead.
Calling this method after the producer's populate stage has completed is an error. Exercise caution when
saving the returned reference in a local variable that is closed over by an asynchronous task as that
circumvents this guard. It is safest to call writeState.getStateEngine()
within the closure.
java.lang.IllegalStateException
- if called after the populate stage has completed (see
HollowProducer.Populator
for details on the contract)HollowProducer.ReadState getPriorState() throws java.lang.IllegalStateException
Calling this method after the producer's populate stage has completed is an error. Exercise caution when
saving the returned reference in a local variable that is closed over by an asynchronous task as that
circumvents this guard. It is safest to call writeState.getPriorState()
within the closure.
java.lang.IllegalStateException
- if called after the populate stage has completed (see
HollowProducer.Populator
for details on the contract)long getVersion() throws java.lang.IllegalStateException
Calling this method after the producer's populate stage has completed is an error.
java.lang.IllegalStateException
- if called after the populate stage has completed (see
HollowProducer.Populator
for details on the contract)void close()
Once closed, calling any other method (aside from close()
will throw
IllegalStateException
. The producer closes the current cycle's write state after the populate
stage is complete.
close
in interface java.lang.AutoCloseable