Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aguibert committed Jul 28, 2019
1 parent 486db60 commit 1404ad8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
# com.ibm.ws.concurrent.mp.1.0 message bundle

# do not translate: CDI, CompletionStage
CWWKC1158.cannot.lazy.enlist.beans=CWWKC1158E: CDI beans used in contextual operations, such as a CompletionStage, must be accessed using a CDI bean operation, such as a public \
method, before context for the operation is captured. The CDI beans that were not accessed before context was captured are: {0}
CWWKC1158.cannot.lazy.enlist.beans.explanation=When CDI context is captured, only CDI beans that have been accessed at that point in time have been created by the CDI \
runtime. As a result, CDI beans that are first accessed in contextual operations cannot propagate their state correctly to subsequent contextual operations.
CWWKC1158.cannot.lazy.enlist.beans.useraction=The application must be changed to invoke some CDI bean operation, such as a public method, before context for the operation is captured.
CWWKC1158.cannot.lazy.enlist.beans=CWWKC1158E:You must access CDI beans prior to capturing context for the contextual action or task in order for the CDI \
beans to behave correctly when accessed from the action or task. The following CDI beans must be accessed before capturing context: {0}.
CWWKC1158.cannot.lazy.enlist.beans.explanation=When CDI context is captured, only CDI beans that have been accessed at that point in time have been created by \
the CDI runtime. As a result, CDI beans that are first accessed in contextual operations cannot propagate their state correctly to subsequent contextual operations.
CWWKC1158.cannot.lazy.enlist.beans.useraction=The application must be changed to invoke some CDI bean operation, such as a public method, before context for \
the operation is captured.
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,16 @@ public void run() {
if (threadContextDescriptor != null)
contextApplied = threadContextDescriptor.taskStarting();
action.run();
} catch (Error x) {
failure = x;
throw x;
} catch (RuntimeException x) {
} catch (Error | RuntimeException x) {
failure = x;
throw x;
} finally {
try {
if (contextApplied != null)
threadContextDescriptor.taskStopping(contextApplied);
} catch (RuntimeException x) {
// prioritize surfacing an actual task failure over a failure clearing context
if (failure == null) {
failure = x;
throw x;
}
failure = x;
throw x;
} finally {
if (completableFuture != null)
if (failure == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@ public void run() {
if (threadContextDescriptor != null)
contextApplied = threadContextDescriptor.taskStarting();
result = action.get();
} catch (Error x) {
} catch (RuntimeException x) {
failure = x;
throw x;
} catch (RuntimeException x) {
} catch (Error x) {
failure = x;
throw x;
} finally {
try {
if (contextApplied != null)
threadContextDescriptor.taskStopping(contextApplied);
} catch (RuntimeException x) {
failure = x;
throw x;
} finally {
if (failure == null)
if (superComplete)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public void testCDIContextPropagationBeanFirstUsedInCompletionStage() throws Exc
}
}
assertTrue("CompletableFuture should have been marked done", cf.isDone());
assertTrue("CompletableFuture should have been marked as completex exceptionally", cf.isCompletedExceptionally());
assertTrue("CompletableFuture should have been marked as completed exceptionally", cf.isCompletedExceptionally());
}

/**
Expand Down

0 comments on commit 1404ad8

Please sign in to comment.