Return the value created by the construct method. Returns null if either the constructing thread or the current thread was interrupted before a value was produced. @return the value created by the construct method
()
| 109 | * @return the value created by the <code>construct</code> method |
| 110 | */ |
| 111 | public Object get() { |
| 112 | while (true) { |
| 113 | Thread t = threadVar.get(); |
| 114 | if (t == null) { |
| 115 | return getValue(); |
| 116 | } |
| 117 | try { |
| 118 | t.join(); |
| 119 | } |
| 120 | catch (InterruptedException e) { |
| 121 | Thread.currentThread().interrupt(); // propagate |
| 122 | return null; |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | |
| 128 | /** |
no test coverage detected