Make LinkedTransferQueue also work in java5 envs.
This commit is contained in:
parent
36e8c4e8f2
commit
3359a565c2
@ -723,12 +723,21 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
|||||||
}
|
}
|
||||||
else if (timed) {
|
else if (timed) {
|
||||||
long now = System.nanoTime();
|
long now = System.nanoTime();
|
||||||
if ((nanos -= now - lastTime) > 0)
|
if ((nanos -= now - lastTime) > 0) {
|
||||||
LockSupport.parkNanos(this, nanos);
|
// Use LockSupport.parkNanose(nanos) to make it compatible with java5
|
||||||
|
//
|
||||||
|
//LockSupport.parkNanos(this, nanos);
|
||||||
|
LockSupport.parkNanos(nanos);
|
||||||
|
}
|
||||||
|
|
||||||
lastTime = now;
|
lastTime = now;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LockSupport.park(this);
|
// Use LockSupport.park() to make it compatible with java5
|
||||||
|
//
|
||||||
|
//LockSupport.park(this);
|
||||||
|
LockSupport.park();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user