io.fabric8.kubernetes.client.informers.ResourceEventHandler Java Examples
The following examples show how to use
io.fabric8.kubernetes.client.informers.ResourceEventHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProcessorListener.java From kubernetes-client with Apache License 2.0 | 5 votes |
public ProcessorListener(ResourceEventHandler<T> handler, long resyncPeriodInMillis) { this.resyncPeriodInMillis = resyncPeriodInMillis; this.handler = handler; this.queue = new LinkedBlockingQueue<>(); determineNextResync(ZonedDateTime.now()); }
Example #2
Source File: ProcessorListener.java From kubernetes-client with Apache License 2.0 | 5 votes |
@Override public void handle(ResourceEventHandler<T> resourceEventHandler) { if (getOldObject() instanceof DeltaFIFO.DeletedFinalStateUnknown) { resourceEventHandler.onDelete(((DeltaFIFO.DeletedFinalStateUnknown<T>) getOldObject()).getObj(), true); } else { resourceEventHandler.onDelete(getOldObject(), false); } }
Example #3
Source File: DefaultSharedIndexInformer.java From kubernetes-client with Apache License 2.0 | 5 votes |
@Override public void addEventHandlerWithResyncPeriod(ResourceEventHandler<T> handler, long resyncPeriodMillis) { if (stopped) { log.info("DefaultSharedIndexInformer#Handler was not added to shared informer because it has stopped already"); return; } if (resyncPeriodMillis > 0) { if (resyncPeriodMillis < MINIMUM_RESYNC_PERIOD_MILLIS) { log.warn("DefaultSharedIndexInformer#resyncPeriod {} is too small. Chanding it to minimul allowed rule of {}", resyncPeriodMillis, MINIMUM_RESYNC_PERIOD_MILLIS); resyncPeriodMillis = MINIMUM_RESYNC_PERIOD_MILLIS; } if (resyncPeriodMillis < this.resyncCheckPeriodMillis) { if (started) { log.warn("DefaultSharedIndexInformer#resyncPeriod {} is smaller than resyncCheckPeriod {} and the informer has already started. Changing it to {}", resyncPeriodMillis, resyncCheckPeriodMillis); resyncPeriodMillis = resyncCheckPeriodMillis; } else { // if the event handler's resyncPeriod is smaller than the current resyncCheckPeriod // update resyncCheckPeriod to match resyncPeriod and adjust the resync periods of all // the listeners accordingly. this.resyncCheckPeriodMillis = resyncPeriodMillis; } } } ProcessorListener<T> listener = new ProcessorListener(handler, determineResyncPeriod(resyncCheckPeriodMillis, this.resyncCheckPeriodMillis)); if (!started) { this.processor.addListener(listener); return; } this.processor.addAndStartListener(listener); List<T> objectList = this.indexer.list(); for (Object item : objectList) { listener.add(new ProcessorListener.AddNotification(item)); } }
Example #4
Source File: ProcessorListener.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Override public void handle(ResourceEventHandler<T> resourceEventHandler) { resourceEventHandler.onUpdate(getOldObject(), getNewObject()); }
Example #5
Source File: ProcessorListener.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Override public void handle(ResourceEventHandler<T> resourceEventHandler) { resourceEventHandler.onAdd(getNewObject()); }
Example #6
Source File: SharedProcessorTest.java From kubernetes-client with Apache License 2.0 | 4 votes |
ExpectingNotificationHandler(ResourceEventHandler<T> handler, long resyncPeriod) { super(handler, resyncPeriod); }
Example #7
Source File: DefaultSharedIndexInformer.java From kubernetes-client with Apache License 2.0 | 2 votes |
/** * add event callback * * @param handler event handler */ @Override public void addEventHandler(ResourceEventHandler<T> handler) { addEventHandlerWithResyncPeriod(handler, defaultEventHandlerResyncPeriod); }
Example #8
Source File: ProcessorListener.java From kubernetes-client with Apache License 2.0 | votes |
public abstract void handle(ResourceEventHandler<T> resourceEventHandler);