diff --git a/util/src/main/java/io/kubernetes/client/util/Watch.java b/util/src/main/java/io/kubernetes/client/util/Watch.java index 7d049a3de6..4ac3e82754 100644 --- a/util/src/main/java/io/kubernetes/client/util/Watch.java +++ b/util/src/main/java/io/kubernetes/client/util/Watch.java @@ -24,6 +24,8 @@ import java.io.IOException; import java.lang.reflect.Type; import java.util.Iterator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Watch class implements watch mechansim of kubernetes. For every list API call with a watch @@ -34,6 +36,8 @@ public class Watch implements Iterable>, Iterator>, java.io.Closeable { + private static final Logger log = LoggerFactory.getLogger(Watch.class); + /** * Response class holds a watch response that has a `type` that can be ADDED, MODIFIED, DELETED * and ERROR. It also hold the actual target object. @@ -78,6 +82,11 @@ public static class Response { */ public static Watch createWatch(ApiClient client, Call call, Type watchType) throws ApiException { + if (client.isDebugging()) { + log.warn( + "Watch is (for now) incompatible with debugging mode active. Watches will not return data until the watch connection terminates"); + throw new ApiException("Watch is incompatible with debugging mode active."); + } try { com.squareup.okhttp.Response response = call.execute(); if (!response.isSuccessful()) {