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> booleanaddIfAbsent(T value, Serializer<T> serializer) Adds the specified value to the cache, serializing the value with the givenSerializer.voidclose()Attempts to notify the server that we are finished communicating with it and cleans up resources<T> booleancontains(T value, Serializer<T> serializer) <T> booleanremove(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, validateMethods 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:
trueif the value is removed,falseif 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
-