Class PowerSetPartitionMap<T extends AsyncCloseable>
- Type Parameters:
T
- The partition type.
- All Implemented Interfaces:
PartitionMap<T>
,AsyncCloseable
,ListenableAsyncCloseable
PartitionMap
that creates the full power set using the individual attributes in
PartitionAttributes
es to create partitions for each add(PartitionAttributes)
.-
Constructor Summary
ConstructorsConstructorDescriptionPowerSetPartitionMap
(Function<PartitionAttributes, T> valueFactory, IntFunction<PartitionAttributesBuilder> partitionAttributesBuilderFunc) Deprecated.Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionadd
(PartitionAttributes partition) Deprecated.Add a newPartitionAttributes
that is absolutely specified.Deprecated.Used to close/shutdown a resource.Deprecated.Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync()
, but attempts to cleanup state before abruptly closing.get
(PartitionAttributes wildCardAttributes) Deprecated.Get the partition value corresponding to thePartitionAttributes
parameter.onClose()
Deprecated.Returns aCompletable
that is notified once theListenableAsyncCloseable
was closed.Deprecated.Returns aCompletable
that is notified when closing begins.remove
(PartitionAttributes partition) Deprecated.Remove aPartitionAttributes
that was previously added viaPartitionMap.add(PartitionAttributes)
.
-
Constructor Details
-
PowerSetPartitionMap
public PowerSetPartitionMap(Function<PartitionAttributes, T> valueFactory, IntFunction<PartitionAttributesBuilder> partitionAttributesBuilderFunc) Deprecated.Create a new instance.- Parameters:
valueFactory
- Generates values for new partitions.partitionAttributesBuilderFunc
- Generates newPartitionAttributes
objects, this factory must be consistent with the factory used to build thePartitionAttributes
objects foradd(PartitionAttributes)
andremove(PartitionAttributes)
to ensureObject.hashCode()
andObject.equals(Object)
are consistent.
-
-
Method Details
-
get
Deprecated.Description copied from interface:PartitionMap
Get the partition value corresponding to thePartitionAttributes
parameter.This may be called from any thread.
- Specified by:
get
in interfacePartitionMap<T extends AsyncCloseable>
- Parameters:
wildCardAttributes
- APartitionAttributes
which identifies the partition. Note that this may not be fully specified, and this is where the "wild card" terminology comes from.- Returns:
- the partition value corresponding to the
PartitionAttributes
parameter.
-
add
Deprecated.Description copied from interface:PartitionMap
Add a newPartitionAttributes
that is absolutely specified. This may create new partitions.The terminology "absolutely"/"fully" here is meant to clarify that
partition
contains all the attributes to uniquely identify a single host. This is typically called when notification is received fromServiceDiscoverer
and that address is translated to the correspondingPartitionAttributes
.This method is not guaranteed to provide any thread safety or visibility with respect to calls to this method or
PartitionMap.remove(PartitionAttributes)
. If these methods are called from multiple threads you may need to provide external synchronization.- Specified by:
add
in interfacePartitionMap<T extends AsyncCloseable>
- Parameters:
partition
- A fully specifiedPartitionAttributes
.- Returns:
- The partitions that
partition
belongs to. These may (or may not) be new partitions.
-
remove
Deprecated.Description copied from interface:PartitionMap
Remove aPartitionAttributes
that was previously added viaPartitionMap.add(PartitionAttributes)
.New partitions typically are not created as a result of this method call.
This method is not guaranteed to provide any thread safety or visibility with respect to calls to this method or
PartitionMap.add(PartitionAttributes)
. If these methods are called from multiple threads you may need to provide external synchronization.- Specified by:
remove
in interfacePartitionMap<T extends AsyncCloseable>
- Parameters:
partition
- A fully specifiedPartitionAttributes
.- Returns:
- The partitions that
partition
belongs to.
-
onClose
Deprecated.Description copied from interface:ListenableAsyncCloseable
Returns aCompletable
that is notified once theListenableAsyncCloseable
was closed.- Specified by:
onClose
in interfaceListenableAsyncCloseable
- Returns:
- the
Completable
that is notified on close.
-
onClosing
Deprecated.Description copied from interface:ListenableAsyncCloseable
Returns aCompletable
that is notified when closing begins.Closing begin might be when a close operation is initiated locally (e.g. subscribing to
AsyncCloseable.closeAsync()
) or it could also be a transport event received from a remote peer (e.g. read aconnection: close
header).For backwards compatibility this method maybe functionally equivalent to
ListenableAsyncCloseable.onClose()
. Therefore, provides a best-effort leading edge notification of closing, but may fall back to notification on trailing edge.The goal of this method is often to notify asap when closing so this method may not be offloaded and care must be taken to avoid blocking if subscribing to the return
Completable
.- Specified by:
onClosing
in interfaceListenableAsyncCloseable
- Returns:
- a
Completable
that is notified when closing begins.
-
closeAsync
Deprecated.Description copied from interface:AsyncCloseable
Used to close/shutdown a resource.- Specified by:
closeAsync
in interfaceAsyncCloseable
- Returns:
- A
Completable
that is notified once the close is complete.
-
closeAsyncGracefully
Deprecated.Description copied from interface:AsyncCloseable
Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync()
, but attempts to cleanup state before abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in flight work. This method is implemented on a "best effort" basis and may be equivalent toAsyncCloseable.closeAsync()
.Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a timeout and force a call to
AsyncCloseable.closeAsync()
.- Specified by:
closeAsyncGracefully
in interfaceAsyncCloseable
- Returns:
- A
Completable
that is notified once the close is complete.
-
ClientGroup
as an alternative or reach out to the maintainers describing the use-case.