开发者社区> 问答> 正文

OSSClient实例使用完后需要调用shutdown方法吗

看到OSSClient有一个shutdown方法,不知道是否需要调用?是不是每次上传文档都需要创建一个OSSClient的实例?

展开
收起
咸鸭蛋 2015-09-08 12:01:51 12260 0
2 条回答
写回答
取消 提交回答
  • ReOSSClient实例使用完后需要调用shutdown方法吗
    我也想知道这个问题,是每次操作后都进行shutdown,第二次再重新获取实例。没有其他操作了么
    2016-04-29 17:22:53
    赞同 展开评论 打赏
  • ReOSSClient实例使用完后需要调用shutdown方法吗
    如果调用shutdown方法, 会抛出线程异常. 看了OSSClient其他的方法, 找不到关闭或者回收连接的, 看debug日志, 会发现每隔60秒, new 过多少个client就有多少条关闭的记录, 关键是关不掉. 下面是我new了2个client, 然后断点停住的日志输出:
    2015-09-09 15:43:50,505 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:44:50,506 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:44:50,506 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:45:50,507 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:45:50,507 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:46:50,508 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:46:50,508 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:47:50,509 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:47:50,509 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:48:50,509 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:48:50,509 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:49:50,510 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:49:50,510 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] - <Closing connections idle longer than 60 SECONDS>
    2015-09-09 15:51:52
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
OSS运维进阶实战手册 立即下载
《OSS运维基础实战手册》 立即下载
OSS运维基础实战手册 立即下载