Skip to content

Commit

Permalink
fix fabric8io#4408: deprecating addSharedInformerEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Oct 11, 2022
1 parent 4d38731 commit 126b694
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -35,6 +35,7 @@
* Module `io.fabric8:tekton-model-triggers` which contained Tekton triggers v1alpha1 model has been removed. We have introduced separate modules `io.fabric8:tekton-model-v1alpha1` and `io.fabric8:tekton-model-v1beta1` for Tekton triggers v1alpha1 and v1beta1 apigroups respectively. Users who are using `io.fabric8:tekton-client` dependency directly should be unaffected by this change.
* Fix #4384: javax.validation.* annotations are no longer added by the Java generator.
* Fix #3864: Now it's compulsory to provide `etc/io.fabric8.openshift.client.cfg` file in order to load ManagedOpenShiftClient in OSGi environment.
* Fix #4408: deprecated SharedInformerFactory.addSharedInformerEventListener, instead use the SharedIndexInformer.stopped method. Also the signature of SharedIndexInformer.start was changed to a CompletionStage rather than a CompletableFuture.

### 5.12.4 (2022-09-30)

Expand Down
Expand Up @@ -175,7 +175,7 @@ default boolean hasSynced() {

/**
* Sets the {@link ExceptionHandler} for this informer. For example, exceptionHandler((b, t) -> true)), will
* keep retying no matter what the exception is.
* keep retrying no matter what the exception is.
* <p>
* May only be called prior to the informer starting
*
Expand Down
Expand Up @@ -81,6 +81,10 @@ <T extends HasMetadata> SharedIndexInformer<T> sharedIndexInformerFor(Class<T> a
*/
void stopAllRegisteredInformers();

/**
* @deprecated use {@link SharedIndexInformer#stopped()} method to get notified when an informer stops.
*/
@Deprecated
void addSharedInformerEventListener(SharedInformerEventListener event);

}
Expand Up @@ -56,8 +56,11 @@ public void onDelete(Dummy pod, boolean deletedFinalStateUnknown) {
}
});

sharedInformerFactory
.addSharedInformerEventListener(ex -> logger.error("Exception occurred, but caught: {}", ex.getMessage()));
podInformer.stopped().whenComplete((v, t) -> {
if (t != null) {
logger.error("Exception occurred, caught: {}", t.getMessage());
}
});

logger.info("Starting all registered informers");
sharedInformerFactory.startAllRegisteredInformers();
Expand Down

0 comments on commit 126b694

Please sign in to comment.