File tree Expand file tree Collapse file tree
branches/autosynth-monitoring/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 @@ -115,7 +115,7 @@ refs/tags/v0.67.0: 30b56f02092efc6f3c3667650ea8b8825003e0b7
115115refs/heads/autosynth-compute: 8e86445e504cea6f99b9fb237bfd7f0e5ef8b3ce
116116refs/heads/autosynth-container: f6384095f50b31bfc8208542a49181e158d3681c
117117refs/heads/autosynth-dataproc: bc74a8841bc1693d7945d991d15979df550b1fd1
118- refs/heads/autosynth-monitoring: d6b2c21e731a4307128d79d65daa64893e421a5a
118+ refs/heads/autosynth-monitoring: 44db7693731df97d301be39001377ed9460b938c
119119refs/heads/autosynth-pubsub: ed3340e32d13bb1a42ca4431cb1ad9bdaf550aa4
120120refs/heads/autosynth-video-intelligence: 3e8faeeee2f803271529bd6e89b621c1ca098628
121121refs/heads/autosynth-vision: d758c43ba2ef4f4f7ad07b722617cb39fe3f29db
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