@Internal public interface TaskChangelogRegistry
StateObjects
, each
representing one or more changelog segments. Changelog segments are uploaded by StateChangelogWriters
of a StateChangelogStorage
.
Initially, when starting the tracking
, the
ownership of a changelog segments is not clear, and it is assumed that JM might
be the owner. The refCount of the StateObject refers to the number of changelog segments contains
in the StateObject. release(StreamStateHandle)
should be called when every changelog
segment become not used, and it will count down the refCount by one. Once the refCount reaches
zero, JM can not become an owner anymore, the state is discarded.
However, if at any point it becomes known that JM is the owner, tracking is stopped
and the state will not be discarded.
It is the client responsibility to call release(StreamStateHandle)
when every
corresponding changelog segment becomes not used.
Modifier and Type | Field and Description |
---|---|
static TaskChangelogRegistry |
NO_OP |
Modifier and Type | Method and Description |
---|---|
static TaskChangelogRegistry |
defaultChangelogRegistry(Executor executor) |
static TaskChangelogRegistry |
defaultChangelogRegistry(int numAsyncDiscardThreads) |
void |
release(StreamStateHandle handle)
Decrease the reference count of the state by one, e.g.
|
void |
startTracking(StreamStateHandle handle,
long refCount)
Start tracking the state uploaded.
|
void |
stopTracking(StreamStateHandle handle)
Stop tracking the state, so that it's not tracked (some other component is doing that).
|
static final TaskChangelogRegistry NO_OP
void startTracking(StreamStateHandle handle, long refCount)
void stopTracking(StreamStateHandle handle)
void release(StreamStateHandle handle)
unregistered
earlier).static TaskChangelogRegistry defaultChangelogRegistry(int numAsyncDiscardThreads)
@VisibleForTesting static TaskChangelogRegistry defaultChangelogRegistry(Executor executor)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.