File tree Expand file tree Collapse file tree
branches/autosynth-speech/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ refs/heads/autosynth-redis: 0cdb2e47359d51b73763bcea8af3de62aa99119b
141141refs/heads/autosynth-scheduler: d97f8743ba965c7d5e492c8dc1f51d023104e260
142142refs/heads/autosynth-securitycenter: 8e95447ccb176c3648880ee0cb926cd1f4065156
143143refs/heads/autosynth-spanner: 9bff86d057df31e04c76d72865e8e073ac5794fb
144- refs/heads/autosynth-speech: d6b2c21e731a4307128d79d65daa64893e421a5a
144+ refs/heads/autosynth-speech: 44db7693731df97d301be39001377ed9460b938c
145145refs/heads/autosynth-tasks: afc9f4da54964dea5e7f3a9b164db282fc35db5c
146146refs/heads/autosynth-texttospeech: 0e26ec9b0ed5bbedc038dea32bbb44bae0883668
147147refs/heads/autosynth-trace: 80c58aa2fb54b0a9c6876f2c21aa8d19cf55962e
Original file line number Diff line number Diff line change 3434public class MetadataConfig {
3535
3636 private static final String METADATA_URL = "http://metadata.google.internal/computeMetadata/v1/" ;
37+ private static final int TIMEOUT_MS = 5000 ;
3738
3839 private MetadataConfig () {}
3940
@@ -69,6 +70,8 @@ public static String getAttribute(String attributeName) {
6970 try {
7071 URL url = new URL (METADATA_URL + attributeName );
7172 HttpURLConnection connection = (HttpURLConnection ) url .openConnection ();
73+ connection .setConnectTimeout (TIMEOUT_MS );
74+ connection .setReadTimeout (TIMEOUT_MS );
7275 connection .setRequestProperty ("Metadata-Flavor" , "Google" );
7376 InputStream input = connection .getInputStream ();
7477 if (connection .getResponseCode () == 200 ) {
You can’t perform that action at this time.
0 commit comments