Created
May 13, 2012 23:24
-
-
Save na-ka-na/2690759 to your computer and use it in GitHub Desktop.
@lombok.Memoize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@lombok.Memoize | |
final Number test(int a, Double b) { | |
return null; | |
} | |
*/ | |
class Test{ | |
@java.lang.SuppressWarnings("all") | |
private final java.util.concurrent.ConcurrentHashMap __lombok_test_c_0 = new java.util.concurrent.ConcurrentHashMap(); | |
@java.lang.SuppressWarnings("all") | |
final Number test(int a, Double b) { | |
java.util.List l = java.util.Arrays.asList(a, b); | |
java.lang.Object[] lock = new java.lang.Object[0]; | |
java.lang.Object[] ret = (java.lang.Object[])__lombok_test_c_0.putIfAbsent(l, lock); | |
if (ret == null) { | |
Number __lombok_calc = __lombok_test(a, b); | |
ret = new java.lang.Object[]{__lombok_calc}; | |
__lombok_test_c_0.put(l, ret); | |
synchronized (lock) { | |
lock.notifyAll(); | |
} | |
} else if (ret.length == 0) { | |
lock = ret; | |
synchronized (lock) { | |
while (ret.length == 0) { | |
try { | |
lock.wait(); | |
} catch (InterruptedException e) { | |
; | |
} | |
ret = (java.lang.Object[])__lombok_test_c_0.get(l); | |
} | |
} | |
} | |
return (Number)ret[0]; | |
} | |
private Number __lombok_test(int a, Double b) { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment