Skip to content

Commit ed1c1a5

Browse files
authored
Update Promises.java
1 parent b617064 commit ed1c1a5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/cn/hackingwu/promise/Promises.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ class Promises {
1515
private static ExecutorService executorService = Executors.newCachedThreadPool();
1616

1717
public static void subscribe(final Promise promise) {
18-
if (!promise.getPromiseList().isPending()) {
18+
PromiseList promiseList = promise.getPromiseList();
19+
if (!promiseList.isPending()) {
1920
Future future = publish(promise);
20-
promise.getPromiseList().setFuture(future);
21+
promiseList.setFuture(future);
22+
promiseList.setPending(true);
2123
}
2224
}
2325

0 commit comments

Comments
 (0)