File tree Expand file tree Collapse file tree
branches/autosynth-iamcredentials/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 @@ -162,7 +162,7 @@ refs/heads/pubsub-ordering-keys: 858d4e986a0ba48e08f00d42f51cbdecb175f5d6
162162refs/tags/v0.75.0: c3673089ae09a897c1b4cf7dfe167fe4f8ab32fb
163163refs/tags/v0.76.0: 395b016826d3ddf9cb8b34919636df15a4dbd032
164164refs/tags/v0.77.0: 28a85a77883ccf5d48f297fd0ef3b3dca6ce01f0
165- refs/heads/autosynth-iamcredentials: d6b2c21e731a4307128d79d65daa64893e421a5a
165+ refs/heads/autosynth-iamcredentials: 44db7693731df97d301be39001377ed9460b938c
166166refs/heads/release-google-cloud-java-v0.78.0: fae5e980779cf0173a152636b278015b9f60ee55
167167refs/heads/release-google-cloud-java-v0.81.0: 0352cd0dd11f4fd1fbd1ff16e7a96beaccc7b475
168168refs/heads/release-google-cloud-java-v0.81.1-SNAPSHOT: 5a74ccb1f12506a3b67b65521881298fde20bd6f
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