Skip to content

Commit

Permalink
fix #4408: deprecating addSharedInformerEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins authored and manusa committed Oct 19, 2022
1 parent 5f6a11a commit 6bb2de9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -6,7 +6,8 @@
* Fix #3733: The authentication command from the .kube/config won't be discarded if no arguments are specified
* Fix #4312: fix timestamp can't be deserialized for IstioCondition
* Fix #4369: Informers will retry with a backoff on list/watch failure as they did in 5.12 and prior.
* Fix #4426: [java-generator] Encode an `AnyType` instead of an Object if `x-kubernetes-preserve-unknown-fields` is present and the type is null.
* Fix #4350: SchemaSwap annotation is now repeatable and is applied multiple times if classes are used more than once in the class hierarchy.
* Fix #3733: The authentication command from the .kube/config won't be discarded if no arguments are specified
* Fix #4441: corrected patch base handling for the patch methods available from a Resource - resource(item).patch() will be evaluated as resource(latest).patch(item). Also undeprecated patch(item), which is consistent with leaving patch(context, item) undeprecated as well. For consistency with the other operations (such as edit), patch(item) will use the context item as the base when available, or the server side item when not. This means that patch(item) is only the same as resource(item).patch() when the patch(item) is called when the context item is missing or is the same as the latest.
* Fix #4442: TokenRefreshInterceptor doesn't overwrite existing OAuth token with empty string
* Fix #4350: SchemaSwap annotation is now repeatable and is applied multiple times if classes are used more than once in the class hierarchy.
Expand Down Expand Up @@ -46,6 +47,7 @@
* Fix #3924: Extension Mock modules have been removed
* Fix #4384: javax.validation.* annotations are no longer added by the Java generator.
* Fix #3906: removed BaseKubernetesList, use KubernetesList instead
* 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 6bb2de9

Please sign in to comment.