public interface Operator extends AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static com.google.common.util.concurrent.ListenableFuture<?> |
NOT_BLOCKED |
| Modifier and Type | Method and Description |
|---|---|
void |
addInput(Page page)
Adds an input page to the operator.
|
default void |
close()
This method will always be called before releasing the Operator reference.
|
void |
finish()
Notifies the operator that no more pages will be added and the
operator should finish processing and flush results.
|
default void |
finishMemoryRevoke()
Clean up and release resources after completed memory revoking.
|
OperatorContext |
getOperatorContext() |
Page |
getOutput()
Gets an output page from the operator.
|
default com.google.common.util.concurrent.ListenableFuture<?> |
isBlocked()
Returns a future that will be completed when the operator becomes
unblocked.
|
boolean |
isFinished()
Is this operator completely finished processing and no more
output pages will be produced.
|
boolean |
needsInput()
Returns true if and only if this operator can accept an input page.
|
default com.google.common.util.concurrent.ListenableFuture<?> |
startMemoryRevoke()
After calling this method operator should revoke all reserved revocable memory.
|
static final com.google.common.util.concurrent.ListenableFuture<?> NOT_BLOCKED
OperatorContext getOperatorContext()
default com.google.common.util.concurrent.ListenableFuture<?> isBlocked()
NOT_BLOCKED.boolean needsInput()
void addInput(Page page)
needsInput() returns true.Page getOutput()
default com.google.common.util.concurrent.ListenableFuture<?> startMemoryRevoke()
Spawned threads can not modify OperatorContext because it's not thread safe.
For this purpose implement finishMemoryRevoke()
Since memory revoking signal is delivered asynchronously to the Operator, implementation must gracefully handle the case when there no longer is any revocable memory allocated.
After this method is called on Operator the Driver is disallowed to call any
processing methods on it (isBlocked/needsInput/addInput/getOutput) until
finishMemoryRevoke() is called.
default void finishMemoryRevoke()
void finish()
boolean isFinished()
default void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2012–2019. All rights reserved.