java 如何释放处于wait的对象?
缓存类部分代码如下
private long time; /** * 存放数据 * @param bytes * @return */ public synchronized boolean putData(byte[] bytes){ try { while(this.isFull()){ time=System.currentTimeMillis(); //用以验证缓存满的时间 this.wait(); } time=0L; this.notify(); } catch (InterruptedException e) { e.printStackTrace(); return false; } this.buff.put(bytes); return true; }