()
| 78 | volatile long expirationNanos; |
| 79 | |
| 80 | @Override |
| 81 | public T get() { |
| 82 | long nanos = expirationNanos; |
| 83 | long now = System.nanoTime(); |
| 84 | if (nanos == 0 || (ttlNanos >= 0 && now - nanos >= 0)) { |
| 85 | synchronized (this) { |
| 86 | if (nanos == expirationNanos) { // recheck for lost race |
| 87 | T t = delegate.get(); |
| 88 | value = t; |
| 89 | nanos = now + ttlNanos; |
| 90 | expirationNanos = (nanos == 0) ? 1 : nanos; |
| 91 | return t; |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | return value; |
| 96 | } |
| 97 | }; |
| 98 | } |
| 99 |
no outgoing calls
no test coverage detected