001package com.box.sdk; 002 003/** 004 * Global settings to apply to all API requests. 005 */ 006public final class BoxGlobalSettings { 007 private static int connectTimeout = 0; 008 private static int readTimeout = 0; 009 private static int maxRetryAttempts = BoxAPIConnection.DEFAULT_MAX_RETRIES; 010 011 private BoxGlobalSettings() { 012 } 013 014 /** 015 * Returns the current global connect timeout. 016 * 017 * @return connect timeout 018 */ 019 public static int getConnectTimeout() { 020 return connectTimeout; 021 } 022 023 /** 024 * Sets the global connect timeout. 025 * 026 * @param connectTimeout timeout in milliseconds 027 */ 028 public static void setConnectTimeout(int connectTimeout) { 029 BoxGlobalSettings.connectTimeout = connectTimeout; 030 } 031 032 /** 033 * Returns the current global read timeout. 034 * 035 * @return read timeout 036 */ 037 public static int getReadTimeout() { 038 return readTimeout; 039 } 040 041 /** 042 * Sets the global read timeout. 043 * 044 * @param readTimeout timeout in milliseconds 045 */ 046 public static void setReadTimeout(int readTimeout) { 047 BoxGlobalSettings.readTimeout = readTimeout; 048 } 049 050 051 /** 052 * Returns the global maximum number of times an API request will be retried after an error response 053 * is received. 054 * 055 * @return max number of request attempts 056 */ 057 public static int getMaxRetryAttempts() { 058 return maxRetryAttempts; 059 } 060 061 /** 062 * Sets the global maximum number of times an API request will be retried after an error response 063 * is received. 064 * 065 * @param attempts maximum number of request attempts 066 */ 067 public static void setMaxRetryAttempts(int attempts) { 068 BoxGlobalSettings.maxRetryAttempts = attempts; 069 } 070}