Java Code Examples for org.eclipse.microprofile.context.ManagedExecutor#shutdown()
The following examples show how to use
org.eclipse.microprofile.context.ManagedExecutor#shutdown() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CDIContextTest.java From microprofile-context-propagation with Apache License 2.0 | 6 votes |
/** * Set some state on Request scoped bean and verify * the state is propagated to the thread where the other task runs. * * If the CDI context in question is not active, the test is deemed successful as there is no propagation to be done. * * @throws Exception indicates test failure */ @Test public void testCDIMECtxPropagatesRequestScopedBean() throws Exception { // check if given context is active, if it isn't test ends successfully try { bm.getContext(RequestScoped.class); } catch (ContextNotActiveException e) { return; } ManagedExecutor propagateCDI = ManagedExecutor.builder().propagated(ThreadContext.CDI) .cleared(ThreadContext.ALL_REMAINING) .build(); Instance<RequestScopedBean> selectedInstance = instance.select(RequestScopedBean.class); assertTrue(selectedInstance.isResolvable()); try { checkCDIPropagation(true, "testCDI_ME_Ctx_Propagate-REQUEST", propagateCDI, selectedInstance.get()); } finally { propagateCDI.shutdown(); } }
Example 2
Source File: CDIContextTest.java From microprofile-context-propagation with Apache License 2.0 | 6 votes |
/** * Set some state on Session scoped bean and verify * the state is propagated to the thread where the other task runs. * * If the CDI context in question is not active, the test is deemed successful as there is no propagation to be done. * * @throws Exception indicates test failure */ @Test public void testCDIMECtxPropagatesSessionScopedBean() throws Exception { // check if given context is active, if it isn't test ends successfully try { bm.getContext(SessionScoped.class); } catch (ContextNotActiveException e) { return; } ManagedExecutor propagateCDI = ManagedExecutor.builder().propagated(ThreadContext.CDI) .cleared(ThreadContext.ALL_REMAINING) .build(); Instance<SessionScopedBean> selectedInstance = instance.select(SessionScopedBean.class); assertTrue(selectedInstance.isResolvable()); try { checkCDIPropagation(true, "testCDI_ME_Ctx_Propagate-SESSION", propagateCDI, selectedInstance.get()); } finally { propagateCDI.shutdown(); } }
Example 3
Source File: CDIContextTest.java From microprofile-context-propagation with Apache License 2.0 | 6 votes |
/** * Set some state on Conversation scoped beans and verify * the state is propagated to the thread where the other task runs. * * If the CDI context in question is not active, the test is deemed successful as there is no propagation to be done. * * @throws Exception indicates test failure */ @Test public void testCDIMECtxPropagatesConversationScopedBean() throws Exception { // check if given context is active, if it isn't test ends successfully try { bm.getContext(ConversationScoped.class); } catch (ContextNotActiveException e) { return; } ManagedExecutor propagateCDI = ManagedExecutor.builder().propagated(ThreadContext.CDI) .cleared(ThreadContext.ALL_REMAINING) .build(); Instance<ConversationScopedBean> selectedInstance = instance.select(ConversationScopedBean.class); assertTrue(selectedInstance.isResolvable()); try { checkCDIPropagation(true, "testCDI_ME_Ctx_Propagate-CONVERSATION", propagateCDI, selectedInstance.get()); } finally { propagateCDI.shutdown(); } }
Example 4
Source File: CDIContextTest.java From microprofile-context-propagation with Apache License 2.0 | 6 votes |
/** * Set some state on Request scoped bean and verify * the state is cleared on the thread where the other task runs. * * If the CDI context in question is not active, the test is deemed successful as there is no propagation to be done. * * @throws Exception indicates test failure */ @Test public void testCDIMECtxClearsRequestScopedBean() throws Exception { // check if given context is active, if it isn't test ends successfully try { bm.getContext(RequestScoped.class); } catch (ContextNotActiveException e) { return; } ManagedExecutor propagatedNone = ManagedExecutor.builder() .propagated() // none .cleared(ThreadContext.ALL_REMAINING) .build(); Instance<RequestScopedBean> selectedInstance = instance.select(RequestScopedBean.class); assertTrue(selectedInstance.isResolvable()); try { checkCDIPropagation(false, "testCDI_ME_Ctx_Clear-REQUEST", propagatedNone, selectedInstance.get()); } finally { propagatedNone.shutdown(); } }
Example 5
Source File: CDIContextTest.java From microprofile-context-propagation with Apache License 2.0 | 6 votes |
/** * Set some state on Session scoped bean and verify * the state is cleared on the thread where the other task runs. * * If the CDI context in question is not active, the test is deemed successful as there is no propagation to be done. * * @throws Exception indicates test failure */ @Test public void testCDIMECtxClearsSessionScopedBeans() throws Exception { // check if given context is active, if it isn't test ends successfully try { bm.getContext(SessionScoped.class); } catch (ContextNotActiveException e) { return; } ManagedExecutor propagatedNone = ManagedExecutor.builder() .propagated() // none .cleared(ThreadContext.ALL_REMAINING) .build(); Instance<SessionScopedBean> selectedInstance = instance.select(SessionScopedBean.class); assertTrue(selectedInstance.isResolvable()); try { checkCDIPropagation(false, "testCDI_ME_Ctx_Clear-SESSION", propagatedNone, selectedInstance.get()); } finally { propagatedNone.shutdown(); } }
Example 6
Source File: CDIContextTest.java From microprofile-context-propagation with Apache License 2.0 | 6 votes |
/** * Set some state on Conversation scoped bean and verify * the state is cleared on the thread where the other task runs. * * If the CDI context in question is not active, the test is deemed successful as there is no propagation to be done. * * @throws Exception indicates test failure */ @Test public void testCDIMECtxClearsConversationScopedBeans() throws Exception { // check if given context is active, if it isn't test ends successfully try { bm.getContext(ConversationScoped.class); } catch (ContextNotActiveException e) { return; } ManagedExecutor propagatedNone = ManagedExecutor.builder() .propagated() // none .cleared(ThreadContext.ALL_REMAINING) .build(); Instance<ConversationScopedBean> selectedInstance = instance.select(ConversationScopedBean.class); assertTrue(selectedInstance.isResolvable()); try { checkCDIPropagation(false, "testCDI_ME_Ctx_Clear-CONVERSATION", propagatedNone, selectedInstance.get()); } finally { propagatedNone.shutdown(); } }
Example 7
Source File: ProducerBean.java From microprofile-context-propagation with Apache License 2.0 | 4 votes |
public void shutdown(@Disposes @MPConfigBean.Max5Queue ManagedExecutor executor) { executor.shutdown(); }
Example 8
Source File: ProducerBean.java From quarkus with Apache License 2.0 | 4 votes |
public void disposeExecutor(@Disposes ManagedExecutor me) { me.shutdown(); }