1 16 package org.apache.axis.components.net; 17 18 import org.apache.axis.AxisProperties; 19 20 29 public class DefaultCommonsHTTPClientProperties implements CommonsHTTPClientProperties { 30 31 33 public static final String MAXIMUM_TOTAL_CONNECTIONS_PROPERTY_KEY = 34 "axis.http.client.maximum.total.connections"; 35 36 38 public static final String MAXIMUM_CONNECTIONS_PER_HOST_PROPERTY_KEY = 39 "axis.http.client.maximum.connections.per.host"; 40 41 43 public static final String CONNECTION_POOL_TIMEOUT_KEY = 44 "axis.http.client.connection.pool.timeout"; 45 46 48 public static final String CONNECTION_DEFAULT_CONNECTION_TIMEOUT_KEY = 49 "axis.http.client.connection.default.connection.timeout"; 50 51 53 public static final String CONNECTION_DEFAULT_SO_TIMEOUT_KEY = 54 "axis.http.client.connection.default.so.timeout"; 55 56 62 protected final int getIntegerProperty(String property, String dephault) { 63 return Integer.parseInt(AxisProperties.getProperty(property, dephault)); 64 } 65 66 72 public int getMaximumTotalConnections() { 73 int i = getIntegerProperty(MAXIMUM_TOTAL_CONNECTIONS_PROPERTY_KEY, "20"); 74 if (i < 1) { 75 throw new IllegalStateException (MAXIMUM_TOTAL_CONNECTIONS_PROPERTY_KEY + " must be > 1"); 76 } 77 return i; 78 } 79 80 86 public int getMaximumConnectionsPerHost() { 87 int i = getIntegerProperty(MAXIMUM_CONNECTIONS_PER_HOST_PROPERTY_KEY, "2"); 88 if (i < 1) { 89 throw new IllegalStateException (MAXIMUM_CONNECTIONS_PER_HOST_PROPERTY_KEY + " must be > 1"); 90 } 91 return i; 92 } 93 94 100 public int getConnectionPoolTimeout() { 101 int i = getIntegerProperty(CONNECTION_POOL_TIMEOUT_KEY, "0"); 102 if (i < 0) { 103 throw new IllegalStateException (CONNECTION_POOL_TIMEOUT_KEY + " must be >= 0"); 104 } 105 return i; 106 } 107 108 114 public int getDefaultConnectionTimeout() { 115 int i = getIntegerProperty(CONNECTION_DEFAULT_CONNECTION_TIMEOUT_KEY, "0"); 116 if (i < 0) { 117 throw new IllegalStateException (CONNECTION_DEFAULT_CONNECTION_TIMEOUT_KEY + " must be >= 0"); 118 } 119 return i; 120 } 121 122 128 public int getDefaultSoTimeout() { 129 int i = getIntegerProperty(CONNECTION_DEFAULT_SO_TIMEOUT_KEY, "0"); 130 if (i < 0) { 131 throw new IllegalStateException (CONNECTION_DEFAULT_SO_TIMEOUT_KEY + " must be >= 0"); 132 } 133 return i; 134 } 135 } 136 | Popular Tags |