2017年11月27日
摘要: 描述:使用等待超时模式来构造一个简单的数据库连接池,在示例中模拟从连接池中获取、使用和释放连接的过程。客户端获取连接的过程被设计成等待超时模式 输出结果: 阅读全文
posted @ 2017-11-27 22:31 飞奔的菜鸟 阅读(405) 评论(0) 推荐(0) 编辑
摘要: 1 //对当前对象加锁 2 public synchronized Object get(long mills) throws InterruptedException{ 3 long future = System.currentTimeMillis() + mills; 4 long remaining = mills; 5 ... 阅读全文
posted @ 2017-11-27 21:15 飞奔的菜鸟 阅读(222) 评论(0) 推荐(0) 编辑