@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)
Creates an
RpcContext . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
JournalContext |
get() |
BlockDeletionContext |
getBlockDeletionContext() |
JournalContext |
getJournalContext() |
void |
journal(Journal.JournalEntry entry)
Syntax sugar for getJournalContext().append(entry).
|
public static final RpcContext NOOP
public RpcContext(BlockDeletionContext blockDeleter, JournalContext journalContext)
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 contextpublic JournalContext getJournalContext()
public void journal(Journal.JournalEntry entry)
entry
- the Journal.JournalEntry
to append to the journalpublic BlockDeletionContext getBlockDeletionContext()
public 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.