@NotThreadSafe public final class RpcContext extends Object implements 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() |
OperationId |
getOpId()
gets op id.
|
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 OperationId getOpId()
public boolean isCancelled()
true
if the operation was cancelledpublic void close() throws UnavailableException
close
in interface Closeable
close
in interface AutoCloseable
UnavailableException
public JournalContext get()
get
in interface java.util.function.Supplier<JournalContext>
Copyright © 2023. All Rights Reserved.