|
122 | 122 | import java.util.Map; |
123 | 123 | import java.util.Objects; |
124 | 124 | import java.util.Set; |
| 125 | +import java.util.concurrent.CancellationException; |
125 | 126 | import java.util.concurrent.ExecutionException; |
126 | 127 | import java.util.concurrent.ScheduledExecutorService; |
127 | 128 | import java.util.concurrent.TimeUnit; |
@@ -163,8 +164,8 @@ final class ClientXdsClient extends XdsClient implements XdsResponseHandler, Res |
163 | 164 | static boolean enableRouteLookup = |
164 | 165 | !Strings.isNullOrEmpty(System.getenv("GRPC_EXPERIMENTAL_XDS_RLS_LB")) |
165 | 166 | && Boolean.parseBoolean(System.getenv("GRPC_EXPERIMENTAL_XDS_RLS_LB")); |
166 | | - |
167 | | - private static final long METADATA_SYNC_TIMEOUT_SEC = 1; |
| 167 | + // Normally this shouldn't take long, but add some slack for cases like a cold JVM. |
| 168 | + private static final long METADATA_SYNC_TIMEOUT_SEC = 20; |
168 | 169 | private static final String TYPE_URL_HTTP_CONNECTION_MANAGER_V2 = |
169 | 170 | "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2" |
170 | 171 | + ".HttpConnectionManager"; |
@@ -2062,7 +2063,7 @@ public void run() { |
2062 | 2063 | return future.get(METADATA_SYNC_TIMEOUT_SEC, TimeUnit.SECONDS); |
2063 | 2064 | } catch (ExecutionException e) { |
2064 | 2065 | throw new UncheckedExecutionException(e.getCause()); |
2065 | | - } catch (TimeoutException e) { |
| 2066 | + } catch (TimeoutException | CancellationException e) { |
2066 | 2067 | throw new UncheckedExecutionException(e); |
2067 | 2068 | } catch (InterruptedException e) { |
2068 | 2069 | logger.log(XdsLogLevel.DEBUG, "Interrupted while preparing subscribed resources snapshot", e); |
|
0 commit comments