@Override protected void runWork() throws WorkCompletedException { // if there is security and elytron is enabled, we need to let the context run the remainder of the work // so the context can run the work as the specified Elytron identity if (securityIntegration.getSecurityContext() != null && ((CallbackImpl) workManager.getCallbackSecurity()).isElytronEnabled()) ((ElytronSecurityContext) securityIntegration.getSecurityContext()).runWork(() -> { try { WildflyWorkWrapper.super.runWork(); } catch (WorkCompletedException e) { ConnectorLogger.ROOT_LOGGER.unexceptedWorkerCompletionError(e.getLocalizedMessage(),e); } }); // delegate to super class if there is no elytron enabled else super.runWork(); } }
ExecutionContext ctx = getWorkContext(TransactionContext.class); if (ctx == null) ctx = getExecutionContext(); fireWorkContextSetupComplete(ctx); getWorkContext(javax.resource.spi.work.SecurityContext.class); if (securityContext != null && workManager.getCallbackSecurity() != null) fireWorkContextSetupFailed(securityContext); throw new WorkException(bundle.securityContextSetupFailedSinceCallbackSecurityDomainWasEmpty()); fireWorkContextSetupComplete(securityContext); fireWorkContextSetupFailed(securityContext); throw new WorkException(bundle.securityContextSetupFailed(t.getMessage()), t); fireWorkContextSetupFailed(securityContext); throw new WorkException(bundle.securityContextSetupFailedSinceCallbackSecurityWasNull());
/** * End */ protected void end() { log.tracef("Ending work: %s", this); ExecutionContext ctx = getWorkContext(TransactionContext.class); if (ctx == null) { ctx = getExecutionContext(); } if (ctx != null) { Xid xid = ctx.getXid(); if (xid != null) { workManager.getXATerminator().endWork(work, xid); } } log.tracef("Ended work: %s", this); }
Work work = wrapper.getWork(); wrapper.addWorkContext(contextType, context);
/** * Crestes a wrapper for work * * @param securityIntegration the security integration * @param work the work * @param executionContext the execution context * @param workListener the work listener * @param startedLatch latch that will be notified when work starts execution. Can be null. * @param completedLatch latch that will be notified when work completes execution. Can be null. * @return the created work wrapper */ protected WorkWrapper createWorkWrapper(SecurityIntegration securityIntegration, Work work, ExecutionContext executionContext, WorkListener workListener, CountDownLatch startedLatch, CountDownLatch completedLatch) { return new WorkWrapper(this, securityIntegration, work, executionContext, workListener, startedLatch, completedLatch, System.currentTimeMillis()); }
/** * {@inheritDoc} */ public synchronized void shutdown() { shutdown.set(true); synchronized (activeWorkWrappers) { for (WorkWrapper ww : activeWorkWrappers) { ww.getWork().release(); } } if (scheduledExecutorService != null) { if (scheduledGraceful != null && !scheduledGraceful.isDone()) scheduledGraceful.cancel(true); scheduledGraceful = null; scheduledExecutorService.shutdownNow(); scheduledExecutorService = null; } if (gracefulCallback != null) { gracefulCallback.done(); gracefulCallback = null; } }
/** * Cancel */ protected void cancel() { log.tracef("Cancel work: %s", this); ExecutionContext ctx = getWorkContext(TransactionContext.class); if (ctx == null) { ctx = getExecutionContext(); } if (ctx != null) { Xid xid = ctx.getXid(); if (xid != null) { workManager.getXATerminator().cancelWork(work, xid); } } log.tracef("Canceled work: %s", this); }
@Override protected void runWork() throws WorkCompletedException { // if there is security and elytron is enabled, we need to let the context run the remainder of the work // so the context can run the work as the specified Elytron identity if (securityIntegration.getSecurityContext() != null && ((CallbackImpl) workManager.getCallbackSecurity()).isElytronEnabled()) ((ElytronSecurityContext) securityIntegration.getSecurityContext()).runWork(() -> { try { WildflyWorkWrapper.super.runWork(); } catch (WorkCompletedException e) { ConnectorLogger.ROOT_LOGGER.unexceptedWorkerCompletionError(e.getLocalizedMessage(),e); } }); // delegate to super class if there is no elytron enabled else super.runWork(); } }