Interface DistributedSetCacheClient
- All Superinterfaces:
org.apache.nifi.components.ConfigurableComponent
,org.apache.nifi.controller.ControllerService
@Tags({"distributed","client","cluster","set","cache"})
@CapabilityDescription("Provides the ability to communicate with a DistributedSetCacheServer. This allows multiple nodes to coordinate state with a single remote entity.")
public interface DistributedSetCacheClient
extends org.apache.nifi.controller.ControllerService
This interface defines an API that can be used for interacting with a
Distributed Cache that functions similarly to a
Set
.-
Method Summary
Modifier and TypeMethodDescription<T> boolean
addIfAbsent
(T value, Serializer<T> serializer) Adds the specified value to the cache, serializing the value with the givenSerializer
.void
close()
Attempts to notify the server that we are finished communicating with it and cleans up resources<T> boolean
contains
(T value, Serializer<T> serializer) <T> boolean
remove
(T value, Serializer<T> serializer) Removes the given value from the cache, if it is present.Methods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
Methods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful, migrateProperties
-
Method Details
-
addIfAbsent
Adds the specified value to the cache, serializing the value with the givenSerializer
.- Type Parameters:
T
- type- Parameters:
value
- valueserializer
- serializer- Returns:
- true if the value was added to the cache, false if the value already existed in the cache
- Throws:
IOException
- if unable to communicate with the remote instance
-
contains
- Type Parameters:
T
- type- Parameters:
value
- valueserializer
- serializer- Returns:
- if the given value is present in the cache and if so returns
true
, else returnsfalse
- Throws:
IOException
- if unable to communicate with the remote instance
-
remove
Removes the given value from the cache, if it is present.- Type Parameters:
T
- type- Parameters:
value
- valueserializer
- serializer- Returns:
true
if the value is removed,false
if the value did not exist in the cache- Throws:
IOException
- ex
-
close
Attempts to notify the server that we are finished communicating with it and cleans up resources- Throws:
IOException
- ex
-