puniverse / quasar

Fibers, Channels and Actors for the JVM
http://docs.paralleluniverse.co/quasar/
Other
4.56k stars 574 forks source link

java.util.concurrent.Callable.call not instrumented ? #239

Closed qiqian closed 7 years ago

qiqian commented 7 years ago

I created a simple zookeeper & curator wrapper, it failed at some internal anonymouse class like new Callable() { @Override public String call() throws Exception }

I tried to add java.util.concurrent.Callable.call in suspendable-supers and System.setProperty("co.paralleluniverse.fibers.allowJdkInstrumentation", "true"); at program launch time

it still fails with the same message log.txt

pron commented 7 years ago

You also need to annotate the implementation of the method (CreateBuilderImpl$11.call). suspendable-supers only means that the interface method may have some suspendable implementations. Please note, however, that using Callable as a suspendable interface is not a good idea; do it only if you have no other choice. It's better to use co.paralleluniverse.strands.SuspendableCallable.

qiqian commented 7 years ago

Problem is "org.apache.curator.framework.imps.CreateBuilderImpl$11.call" is from curator library, I don't want to modify curator I try to put "org.apache.curator.framework.imps.CreateBuilderImpl$11.call" in suspendable, it doesn't seem to work

pron commented 7 years ago

You may want to run with verifyInstrumentation to see what's missing, but I think this is the wrong approach for making this library fiber-friendly. The way to make Curator fiber-friendly is not by instrumenting it, but by wrapping its async operations with FiberAsync as explained in this blog post. In particular, you'd want to reimplement the GetDataBuilder, SetDataBuilder etc. interfaces, and use FiberAsync along with the asynchronous API using Backgroundable.

pron commented 7 years ago

Closing for no activity