@Override protected void setCallbackSecurity(org.jboss.jca.core.api.workmanager.WorkManager workManager, Callback cb) { if (cb instanceof CallbackImpl) { if (((CallbackImpl) cb).isElytronEnabled() != ((NamedWorkManager) workManager).isElytronEnabled()) throw ConnectorLogger.ROOT_LOGGER.invalidElytronWorkManagerSetting(); workManager.setCallbackSecurity(cb); } else { super.setCallbackSecurity(workManager, cb); } }
@Override public void start(StartContext context) throws StartException { synchronized (this) { WorkManager wm = workManager.getValue(); wm.setStatisticsEnabled(statsEnabled); if (wm.getStatistics() != null) { PathElement peLocaldWm = PathElement.pathElement(Constants.STATISTICS_NAME, "local"); ResourceBuilder resourceBuilder = ResourceBuilder.Factory.create(peLocaldWm, new StandardResourceDescriptionResolver(Constants.STATISTICS_NAME + "." + Constants.WORKMANAGER_NAME, CommonAttributes.RESOURCE_NAME, CommonAttributes.class.getClassLoader())); ManagementResourceRegistration wmSubRegistration = overrideRegistration.registerSubModel(resourceBuilder.build()); OperationStepHandler metricHandler = new WorkManagerRuntimeAttributeReadHandler(wm, wm.getStatistics(), false); for (SimpleAttributeDefinition metric : Constants.WORKMANAGER_METRICS) { wmSubRegistration.registerMetric(metric, metricHandler); } OperationStepHandler readHandler = new WorkManagerRuntimeAttributeReadHandler(wm, wm.getStatistics(), false); OperationStepHandler writeHandler = new WorkManagerRuntimeAttributeWriteHandler(wm, false, Constants.WORKMANAGER_RW_ATTRIBUTES); for (SimpleAttributeDefinition attribute : Constants.WORKMANAGER_RW_ATTRIBUTES) { wmSubRegistration.registerReadWriteAttribute(attribute, readHandler, writeHandler); } wmSubRegistration.registerOperationHandler(ClearWorkManagerStatisticsHandler.DEFINITION, new ClearWorkManagerStatisticsHandler(wm)); } } }
result.set(((DistributedWorkManager) wm).isDistributedStatisticsEnabled()); } else { result.set(wm.isStatisticsEnabled()); result.set(wm.isStatisticsEnabled()); break;
@Override public void start(StartContext context) throws StartException { BlockingExecutor longRunning = (BlockingExecutor) executorLong.getOptionalValue(); if (longRunning != null) { this.value.setLongRunningThreadPool(longRunning); this.value.setShortRunningThreadPool((BlockingExecutor) executorShort.getValue()); } else { this.value.setLongRunningThreadPool((BlockingExecutor) executorShort.getValue()); this.value.setShortRunningThreadPool((BlockingExecutor) executorShort.getValue()); } this.value.setXATerminator(new XATerminatorImpl(xaTerminator.getValue())); // TODO - Remove and do proper integration (IronJacamar 1.1) String callbackProperties = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return System.getProperty("callback.properties"); } }); if (callbackProperties != null) { try { DefaultCallback defaultCallback = new DefaultCallback(callbackProperties); defaultCallback.start(); this.callback = defaultCallback; this.value.setCallbackSecurity(callback); } catch (Throwable t) { ROOT_LOGGER.debug(t.getMessage(), t); } } ROOT_LOGGER.debugf("Starting JCA WorkManager"); }
dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); throw new IllegalArgumentException("The WorkManager wasn't found: " + name); WorkManager wm = template.clone(); wm.setId(id); dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId()));
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { wm.getStatistics().clear(); context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, OperationContext.Stage.RUNTIME);
((DistributedWorkManager) wm).setDistributedStatisticsEnabled(resolvedValue.asBoolean()); } else { wm.setStatisticsEnabled(resolvedValue.asBoolean()); wm.setStatisticsEnabled(resolvedValue.asBoolean()); break;
/** * {@inheritDoc} */ public void run() { wm.shutdown(); } }
/** * Set the default work manager * @param wm The work manager */ public void setDefaultWorkManager(WorkManager wm) { log.tracef("Default WorkManager: %s", wm); String currentName = null; if (defaultWorkManager != null) currentName = defaultWorkManager.getName(); defaultWorkManager = wm; if (wm != null) { workmanagers.put(wm.getName(), wm); } else if (currentName != null) { workmanagers.remove(currentName); } }
/** * localGetLongRunningFree * * @param address the logical address * @return the free count */ public long localGetLongRunningFree(Address address) { log.tracef("LOCAL_GET_LONGRUNNING_FREE(%s)", address); WorkManagerCoordinator wmc = WorkManagerCoordinator.getInstance(); WorkManager wm = wmc.resolveWorkManager(address); if (wm != null) { StatisticsExecutor executor = wm.getLongRunningThreadPool(); if (executor != null) return executor.getNumberOfFreeThreads(); } return 0L; }
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { wm.getStatistics().clear(); context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, OperationContext.Stage.RUNTIME);
((DistributedWorkManager) wm).setDistributedStatisticsEnabled(resolvedValue.asBoolean()); } else { wm.setStatisticsEnabled(resolvedValue.asBoolean()); wm.setStatisticsEnabled(resolvedValue.asBoolean()); break;
@Override public void stop(StopContext context) { value.shutdown(); try { if (callback != null) callback.stop(); } catch (Throwable t) { ROOT_LOGGER.debug(t.getMessage(), t); } }
/** * Unregister work manager * @param wm The work manager */ public void unregisterWorkManager(WorkManager wm) { if (wm != null) { if (wm.getName() == null || wm.getName().trim().equals("")) throw new IllegalArgumentException("The name of WorkManager is invalid: " + wm); log.tracef("Unregistering WorkManager: %s", wm); if (workmanagers.keySet().contains(wm.getName())) { workmanagers.remove(wm.getName()); // Clear any events if (wm instanceof DistributedWorkManager) { WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance(); List<WorkManagerEvent> events = wmeq.getEvents(wm.getName()); events.clear(); } } } }
@Override public void start(StartContext context) throws StartException { synchronized (this) { WorkManager wm = workManager.getValue(); wm.setStatisticsEnabled(statsEnabled); if (wm.getStatistics() != null) { PathElement peLocaldWm = PathElement.pathElement(Constants.STATISTICS_NAME, "local"); ResourceBuilder resourceBuilder = ResourceBuilder.Factory.create(peLocaldWm, new StandardResourceDescriptionResolver(Constants.STATISTICS_NAME + "." + Constants.WORKMANAGER_NAME, CommonAttributes.RESOURCE_NAME, CommonAttributes.class.getClassLoader())); ManagementResourceRegistration wmSubRegistration = overrideRegistration.registerSubModel(resourceBuilder.build()); OperationStepHandler metricHandler = new WorkManagerRuntimeAttributeReadHandler(wm, wm.getStatistics(), false); for (SimpleAttributeDefinition metric : Constants.WORKMANAGER_METRICS) { wmSubRegistration.registerMetric(metric, metricHandler); } OperationStepHandler readHandler = new WorkManagerRuntimeAttributeReadHandler(wm, wm.getStatistics(), false); OperationStepHandler writeHandler = new WorkManagerRuntimeAttributeWriteHandler(wm, false, Constants.WORKMANAGER_RW_ATTRIBUTES); for (SimpleAttributeDefinition attribute : Constants.WORKMANAGER_RW_ATTRIBUTES) { wmSubRegistration.registerReadWriteAttribute(attribute, readHandler, writeHandler); } wmSubRegistration.registerOperationHandler(ClearWorkManagerStatisticsHandler.DEFINITION, new ClearWorkManagerStatisticsHandler(wm)); } } }
@Override protected void setCallbackSecurity(org.jboss.jca.core.api.workmanager.WorkManager workManager, Callback cb) { if (cb instanceof CallbackImpl) { if (((CallbackImpl) cb).isElytronEnabled() != ((NamedWorkManager) workManager).isElytronEnabled()) throw ConnectorLogger.ROOT_LOGGER.invalidElytronWorkManagerSetting(); workManager.setCallbackSecurity(cb); } else { super.setCallbackSecurity(workManager, cb); } }
result.set(((DistributedWorkManager) wm).isDistributedStatisticsEnabled()); } else { result.set(wm.isStatisticsEnabled()); result.set(wm.isStatisticsEnabled()); break;