@NotThreadSafe public final class RpcContext extends java.lang.Object implements java.io.Closeable, java.util.function.Supplier<JournalContext>
Closer because it doesn't make
guarantees about the order in which resources are closed.| Modifier and Type | Field and Description |
|---|---|
static RpcContext |
NOOP |
| Constructor and Description |
|---|
RpcContext(BlockDeletionContext blockDeleter,
JournalContext journalContext,
OperationContext operationContext)
Creates an
RpcContext. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
JournalContext |
get() |
BlockDeletionContext |
getBlockDeletionContext() |
JournalContext |
getJournalContext() |
OperationContext |
getOperationContext() |
boolean |
isCancelled() |
void |
journal(Journal.JournalEntry entry)
Syntax sugar for getJournalContext().append(entry).
|
void |
throwIfCancelled()
Throws
RuntimeException if the RPC was cancelled by any tracker. |
public static final RpcContext NOOP
public RpcContext(BlockDeletionContext blockDeleter, JournalContext journalContext, OperationContext operationContext)
RpcContext. This class aggregates different contexts used over the course of
an RPC, and makes sure they are closed in the right order when the RPC is finished.blockDeleter - block deletion contextjournalContext - journal contextoperationContext - the operation contextpublic JournalContext getJournalContext()
public void journal(Journal.JournalEntry entry)
entry - the Journal.JournalEntry to append to the journalpublic BlockDeletionContext getBlockDeletionContext()
public OperationContext getOperationContext()
public void throwIfCancelled()
RuntimeException if the RPC was cancelled by any tracker.public boolean isCancelled()
true if the operation was cancelledpublic void close()
throws UnavailableException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableUnavailableExceptionpublic JournalContext get()
get in interface java.util.function.Supplier<JournalContext>Copyright © 2020. All Rights Reserved.