()
| 78 | } |
| 79 | |
| 80 | public final N get() { |
| 81 | final N ref = node; |
| 82 | if (ref != null) { |
| 83 | /* Node is in memory, just return it */ |
| 84 | return ref; |
| 85 | } else { |
| 86 | /* read Node from disk */ |
| 87 | try { |
| 88 | return getSynchronized(); |
| 89 | } catch (Exception e) { |
| 90 | throw new RuntimeException(e); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | /** deserialize node from disk, synchronized to ensure this only happens once in a multi-threaded setup */ |
| 96 | private final synchronized N getSynchronized() throws IOException { |