public class SharedStateRegistry extends Object implements AutoCloseable
SharedStateRegistry
will be deployed in the
CheckpointCoordinator
to
maintain the reference count of StreamStateHandle
s by a key that (logically) identifies
them.Modifier and Type | Class and Description |
---|---|
static class |
SharedStateRegistry.Result
The result of an attempt to (un)/reference state
|
Modifier and Type | Field and Description |
---|---|
static SharedStateRegistryFactory |
DEFAULT_FACTORY
A singleton object for the default implementation of a
SharedStateRegistryFactory |
Constructor and Description |
---|
SharedStateRegistry()
Default uses direct executor to delete unreferenced state
|
SharedStateRegistry(Executor asyncDisposalExecutor) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
registerAll(Iterable<? extends CompositeStateHandle> stateHandles)
Register given shared states in the registry.
|
SharedStateRegistry.Result |
registerReference(SharedStateRegistryKey registrationKey,
StreamStateHandle state)
Register a reference to the given shared state in the registry.
|
String |
toString() |
SharedStateRegistry.Result |
unregisterReference(SharedStateRegistryKey registrationKey)
Releases one reference to the given shared state in the registry.
|
public static final SharedStateRegistryFactory DEFAULT_FACTORY
SharedStateRegistryFactory
public SharedStateRegistry()
public SharedStateRegistry(Executor asyncDisposalExecutor)
public SharedStateRegistry.Result registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle state)
IMPORTANT: caller should check the state handle returned by the result, because the registry is performing de-duplication and could potentially return a handle that is supposed to replace the one from the registration request.
state
- the shared state for which we register a reference.public SharedStateRegistry.Result unregisterReference(SharedStateRegistryKey registrationKey)
registrationKey
- the shared state for which we release a reference.public void registerAll(Iterable<? extends CompositeStateHandle> stateHandles)
stateHandles
- The shared states to register.public void close()
close
in interface AutoCloseable
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.