Hey,
Simple question, does Deuce support the use of java.util.concurrent classes, for example Futures?
I tried this simple test program, that runs the following method:
@Atomic(retries=1)
public void addvalue() {
mapa.add("aaa");
ExecutorService exeService = Executors.newFixedThreadPool(10);
FutureTask<Integer> future = new FutureTask<Integer>(
new Callable<Integer>()
{
public Integer call()
{
return addvalue2();
}
});
exeService.execute(future);
try{
System.out.println(future.get());
}catch(Exception e) {}
exeService.shutdown();
throw new TransactionException("Key not found");
}
public Integer addvalue2(){
mapa.add("bbb");
return 1;
}
I instrumented the rt.jar and my program, tried to run and it throws the following exception:
Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
at java.lang.System.getSecurityManager(System.java:325)
at java.util.concurrent.Executors$DefaultThreadFactory.<init>(Executors.java:563)
at java.util.concurrent.Executors.defaultThreadFactory(Executors.java:317)
at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1199)
at java.util.concurrent.Executors.newFixedThreadPool(Executors.java:89)
at Main2.addvalue(Main2.java:25)
at Main2.addvalue(Main2.java)
at Main2.run(Main2.java:18)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NoSuchFieldException: security
at java.lang.Class.getDeclaredField(Class.java:1929)
at java.lang.SystemDeuceFieldsHolder.<clinit>(Unknown Source)
... 9 more
Also, if Deuce supports this classes, what does it happen? I mean, what method does the thread created by the future run, addvalue2() (no transaction) or an instrumented version of addvalue2() (in the context of a transaction)? Does that same thread run as a nested transaction or a new distinct transaction that can commit without waiting for the transaction that created the future?
Thx in advance.