T
- The value object which represents the partition.public interface PartitionMap<T extends AsyncCloseable> extends ListenableAsyncCloseable
PartitionAttributes
that are fully specified and returns the corresponding
partitions those PartitionAttributes
belong to.Modifier and Type | Method and Description |
---|---|
java.util.List<T> |
add(PartitionAttributes partition)
Add a new
PartitionAttributes that is absolutely specified. |
T |
get(PartitionAttributes wildCardAttributes)
Get the partition value corresponding to the
PartitionAttributes parameter. |
java.util.List<T> |
remove(PartitionAttributes partition)
Remove a
PartitionAttributes that was previously added via add(PartitionAttributes) . |
onClose
closeAsync, closeAsyncGracefully
java.util.List<T> add(PartitionAttributes partition)
PartitionAttributes
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 from
ServiceDiscoverer
and that address is translated to the corresponding PartitionAttributes
.
This method is not guaranteed to provide any thread safety or visibility with respect to calls to this method or
remove(PartitionAttributes)
. If these methods are called from multiple threads you may need to
provide external synchronization.
partition
- A fully specified PartitionAttributes
.partition
belongs to. These may (or may not) be new partitions.java.util.List<T> remove(PartitionAttributes partition)
PartitionAttributes
that was previously added via 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
add(PartitionAttributes)
. If these methods are called from multiple threads you may need to
provide external synchronization.
partition
- A fully specified PartitionAttributes
.partition
belongs to.@Nullable T get(@Nullable PartitionAttributes wildCardAttributes)
PartitionAttributes
parameter.
This may be called from any thread.
wildCardAttributes
- A PartitionAttributes
which identifies the partition. Note that this may not be
fully specified, and this is where the "wild card" terminology comes from.PartitionAttributes
parameter.