Class SharedProcessor<T>
- java.lang.Object
-
- io.fabric8.kubernetes.client.informers.impl.cache.SharedProcessor<T>
-
public class SharedProcessor<T> extends Object
SharedProcessor class manages all the registered ProcessListener and distributes notifications. This has been taken from official-client: https://github.com/kubernetes-client/java/blob/main/util/src/main/java/io/kubernetes/client/informer/cache/SharedProcessor.java
Modified to simplify threading
-
-
Constructor Summary
Constructors Constructor Description SharedProcessor()
SharedProcessor(Executor executor, String informerDescription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(ProcessorListener<T> processorListener)
Adds the specific processorListenerProcessorListener<T>
addProcessorListener(ResourceEventHandler<? super T> handler, long resyncPeriodMillis, Supplier<Collection<T>> initialItems)
Adds a new listener.void
distribute(ProcessorListener.Notification<T> obj, boolean isSync)
Distribute the object amount listeners.void
distribute(Consumer<ProcessorListener<T>> operation, boolean isSync)
Distribute the operation to the respective listenersvoid
executeIfPossible(Runnable runnable)
Optional<Long>
getMinimalNonZeroResyncPeriod()
Optional<ProcessorListener<T>>
removeProcessorListener(ResourceEventHandler<? super T> handler)
boolean
shouldResync()
void
stop()
-
-
-
Method Detail
-
addListener
public void addListener(ProcessorListener<T> processorListener)
Adds the specific processorListener- Parameters:
processorListener
- specific processor listener
-
distribute
public void distribute(ProcessorListener.Notification<T> obj, boolean isSync)
Distribute the object amount listeners.- Parameters:
obj
- specific objisSync
- whether in sync or not
-
distribute
public void distribute(Consumer<ProcessorListener<T>> operation, boolean isSync)
Distribute the operation to the respective listeners
-
shouldResync
public boolean shouldResync()
-
stop
public void stop()
-
addProcessorListener
public ProcessorListener<T> addProcessorListener(ResourceEventHandler<? super T> handler, long resyncPeriodMillis, Supplier<Collection<T>> initialItems)
Adds a new listener. When running this will pause event distribution until the new listener has received an initial set of add events
-
removeProcessorListener
public Optional<ProcessorListener<T>> removeProcessorListener(ResourceEventHandler<? super T> handler)
-
executeIfPossible
public void executeIfPossible(Runnable runnable)
-
-