diff --git a/README.md b/README.md index ba978b1..20e11c9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ mvn install:install-file -DgroupId=org.csource -DartifactId=fastdfs-client-java org.csource fastdfs-client-java - 1.27-SNAPSHOT + 1.28-SNAPSHOT ``` @@ -53,6 +53,11 @@ http.secret_key = FastDFS1234567890 tracker_server = 10.0.11.247:22122 tracker_server = 10.0.11.248:22122 tracker_server = 10.0.11.249:22122 + +connection_pool.enabled = true +connection_pool.max_count_per_entry = 500 +connection_pool.max_idle_time = 3600 +connection_pool.max_wait_time_in_ms = 1000 ``` 注1:tracker_server指向您自己IP地址和端口,1-n个 @@ -80,6 +85,11 @@ fastdfs.http_secret_key = FastDFS1234567890 fastdfs.http_tracker_http_port = 80 fastdfs.tracker_servers = 10.0.11.201:22122,10.0.11.202:22122,10.0.11.203:22122 + +fastdfs.connection_pool.enabled = true +fastdfs.connection_pool.max_count_per_entry = 500 +fastdfs.connection_pool.max_idle_time = 3600 +fastdfs.connection_pool.max_wait_time_in_ms = 1000 ``` 注1:properties 配置文件中属性名跟 conf 配置文件不尽相同,并且统一加前缀"fastdfs.",便于整合到用户项目配置文件 @@ -122,6 +132,10 @@ ClientGlobal.configInfo(): { g_anti_steal_token = false g_secret_key = FastDFS1234567890 g_tracker_http_port = 80 + g_connection_pool_enabled = true + g_connection_pool_max_count_per_entry = 500 + g_connection_pool_max_idle_time(ms) = 3600000 + g_connection_pool_max_wait_time_in_ms(ms) = 1000 trackerServers = 10.0.11.101:22122,10.0.11.102:22122 } ``` diff --git a/src/main/java/org/csource/fastdfs/ClientGlobal.java b/src/main/java/org/csource/fastdfs/ClientGlobal.java index 2099b3c..ff465be 100644 --- a/src/main/java/org/csource/fastdfs/ClientGlobal.java +++ b/src/main/java/org/csource/fastdfs/ClientGlobal.java @@ -56,7 +56,7 @@ public class ClientGlobal { public static final String DEFAULT_HTTP_SECRET_KEY = "FastDFS1234567890"; public static final int DEFAULT_HTTP_TRACKER_HTTP_PORT = 80; - public static final boolean DEFAULT_CONNECTION_POOL_ENABLED = false; + public static final boolean DEFAULT_CONNECTION_POOL_ENABLED = true; public static final int DEFAULT_CONNECTION_POOL_MAX_COUNT_PER_ENTRY = 100; public static final int DEFAULT_CONNECTION_POOL_MAX_IDLE_TIME = 3600 ;//second public static final int DEFAULT_CONNECTION_POOL_MAX_WAIT_TIME_IN_MS = 1000 ;//millisecond @@ -349,8 +349,8 @@ public class ClientGlobal { + "\n g_tracker_http_port = " + g_tracker_http_port + "\n g_connection_pool_enabled = " + g_connection_pool_enabled + "\n g_connection_pool_max_count_per_entry = " + g_connection_pool_max_count_per_entry - + "\n g_connection_pool_max_idle_time = " + g_connection_pool_max_idle_time - + "\n g_connection_pool_max_wait_time_in_ms = " + g_connection_pool_max_wait_time_in_ms + + "\n g_connection_pool_max_idle_time(ms) = " + g_connection_pool_max_idle_time + + "\n g_connection_pool_max_wait_time_in_ms(ms) = " + g_connection_pool_max_wait_time_in_ms + "\n trackerServers = " + trackerServers + "\n}"; }