[ https://issues.apache.org/jira/browse/UIMA-4197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Eckart de Castilho resolved UIMA-4197. ---------------------------------------------- Resolution: Abandoned DUCC has been retired. > Using non-blocking "Future" instead of blocking "Future.get" to improve > performance? > ------------------------------------------------------------------------------------ > > Key: UIMA-4197 > URL: https://issues.apache.org/jira/browse/UIMA-4197 > Project: UIMA > Issue Type: Improvement > Components: DUCC > Reporter: Yu Lin > Priority: Minor > Fix For: future-DUCC > > > Hi, I'm doing research on asynchronous programming. I found at some places, > the code in uima-ducc ("trunk" branch) invokes "Future.get()", while it is a > blocking call. > For example, in "startAgents" method of "DuccAdmin" class (line 296), you > invoke "result.get()", where "result" is a Future, so the code blocks. > Why not use Guava ListenableFuture or Java8 CompletableFuture and avoid > "Future.get()"? These two new constructs provide callbacks to listen to the > Future's result: > http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/util/concurrent/ListenableFuture.html > https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html > For example, in "DuccAdmin" class, you may put the code after "result.get()" > (such as lines 301-307) into "CompletableFuture.thenRunAsync" method. > Then make "startAgents" method return this CompletableFuture, and in the > callers (such as "DuccAdmin.process()" or "DuccAdmin.main" method) you can > put more continuations into "CompletableFuture.thenRunAsync". And you can > also invoke "Future.get" somewhere in the callers (for example in > "DuccAdmin.process()" method), instead of immediately. > Do you think such kind of change is correct and can improve the code? -- This message was sent by Atlassian Jira (v8.20.10#820010)