Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/ComputeInExecutor.java @ 22350:b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Thu, 05 Nov 2015 18:42:36 +0100 |
parents | |
children |
rev | line source |
---|---|
22350
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
1 /* |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
4 * |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
10 * |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
16 * |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
20 * |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
23 * questions. |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
24 */ |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.vm; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
26 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
27 import java.io.IOException; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
28 import java.io.InterruptedIOException; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
29 import java.util.concurrent.Executor; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
30 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
31 abstract class ComputeInExecutor<R> implements Runnable { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
32 private final Executor executor; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
33 private R result; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
34 private Throwable exception; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
35 private boolean started; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
36 private boolean done; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
37 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
38 protected ComputeInExecutor(Executor executor) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
39 this.executor = executor; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
40 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
41 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
42 protected abstract R compute() throws IOException; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
43 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
44 public final R get() throws IOException { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
45 perform(); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
46 if (executor != null) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
47 waitForDone(); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
48 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
49 exceptionCheck(); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
50 return result; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
51 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
52 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
53 private void waitForDone() throws InterruptedIOException { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
54 synchronized (this) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
55 while (!done) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
56 try { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
57 wait(); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
58 } catch (InterruptedException ex) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
59 throw new InterruptedIOException(ex.getMessage()); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
60 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
61 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
62 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
63 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
64 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
65 private void exceptionCheck() throws IOException, RuntimeException { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
66 if (exception instanceof IOException) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
67 throw (IOException) exception; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
68 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
69 if (exception instanceof RuntimeException) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
70 throw (RuntimeException) exception; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
71 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
72 if (exception != null) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
73 throw new RuntimeException(exception); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
74 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
75 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
76 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
77 public final void perform() throws IOException { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
78 if (started) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
79 return; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
80 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
81 started = true; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
82 if (executor == null) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
83 run(); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
84 } else { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
85 executor.execute(this); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
86 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
87 exceptionCheck(); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
88 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
89 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
90 @Override |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
91 public final void run() { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
92 try { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
93 result = compute(); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
94 } catch (Exception ex) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
95 exception = ex; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
96 } finally { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
97 if (executor != null) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
98 synchronized (this) { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
99 done = true; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
100 notifyAll(); |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
101 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
102 } else { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
103 done = true; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
104 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
105 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
106 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
107 |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
108 @Override |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
109 public final String toString() { |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
110 return "value=" + result + ",exception=" + exception + ",computed=" + done; |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
111 } |
b1c71f0c1a85
Unifying the executor access into single ComputeInExecutor class and removing the need for CountDownLatch
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
112 } |