File tree Expand file tree Collapse file tree
branches/autosynth-container/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 @@ -112,7 +112,7 @@ refs/tags/v0.65.0: 10939381ffe0b8da32db4fe3087c86e3aa7f3e55
112112refs/tags/v0.66.0: ed6a3f57cbdaa20339a1995f7d7d53b172a5b8ef
113113refs/tags/v0.67.0: 30b56f02092efc6f3c3667650ea8b8825003e0b7
114114refs/heads/autosynth-compute: 026cea73fde22ec0b40866ac5a7dc144dc465b9b
115- refs/heads/autosynth-container: d6b2c21e731a4307128d79d65daa64893e421a5a
115+ refs/heads/autosynth-container: 44db7693731df97d301be39001377ed9460b938c
116116refs/heads/autosynth-monitoring: 832528c131ac32b115fd7a369701d9e6e4ec62e5
117117refs/heads/autosynth-pubsub: 7a327eaed5fb2a5d6c1691feb73c3e0194dd805e
118118refs/heads/autosynth-video-intelligence: 53ca56e5d077bf67065b730f3fe621f40689fb4c
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