Search in sources :

Example 1 with ManagedScheduledExecutorService

use of org.glassfish.concurrent.config.ManagedScheduledExecutorService in project Payara by payara.

the class ManagedScheduledExecutorServiceDeployer method undeployResource.

@Override
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception {
    ManagedScheduledExecutorService managedscheduledexecutorserviceRes = (ManagedScheduledExecutorService) resource;
    ResourceInfo resourceInfo = new ResourceInfo(managedscheduledexecutorserviceRes.getJndiName(), applicationName, moduleName);
    namingService.unpublishObject(resourceInfo, managedscheduledexecutorserviceRes.getJndiName());
    // stop the runtime object
    concurrentRuntime.shutdownScheduledManagedExecutorService(managedscheduledexecutorserviceRes.getJndiName());
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ManagedScheduledExecutorService(org.glassfish.concurrent.config.ManagedScheduledExecutorService)

Example 2 with ManagedScheduledExecutorService

use of org.glassfish.concurrent.config.ManagedScheduledExecutorService in project Payara by payara.

the class ListManagedScheduledExecutorServices method execute.

/**
 * Executes the command with the command parameters passed as Properties
 * where the keys are the parameter names and the values the parameter values
 *
 * @param context information
 */
public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();
    try {
        Collection<ManagedScheduledExecutorService> managedScheduledExecutorServices = domain.getResources().getResources(ManagedScheduledExecutorService.class);
        List<Map<String, String>> resourcesList = new ArrayList<Map<String, String>>();
        List<DefaultResourceProxy> drps = habitat.getAllServices(DefaultResourceProxy.class);
        for (ManagedScheduledExecutorService managedScheduledExecutorService : managedScheduledExecutorServices) {
            String jndiName = managedScheduledExecutorService.getJndiName();
            if (bindableResourcesHelper.resourceExists(jndiName, target)) {
                ActionReport.MessagePart part = report.getTopMessagePart().addChild();
                part.setMessage(jndiName);
                Map<String, String> resourceNameMap = new HashMap<String, String>();
                String logicalName = DefaultResourceProxy.Util.getLogicalName(drps, jndiName);
                if (logicalName != null) {
                    resourceNameMap.put("logical-jndi-name", logicalName);
                }
                resourceNameMap.put("name", jndiName);
                resourcesList.add(resourceNameMap);
            }
        }
        Properties extraProperties = new Properties();
        extraProperties.put("managedScheduledExecutorServices", resourcesList);
        report.setExtraProperties(extraProperties);
    } catch (Exception e) {
        report.setMessage(localStrings.getLocalString("list.managed.scheduled.executor.service.failed", "List managed scheduled executor services failed"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        report.setFailureCause(e);
        return;
    }
    report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Also used : DefaultResourceProxy(org.glassfish.api.naming.DefaultResourceProxy) ActionReport(org.glassfish.api.ActionReport) ManagedScheduledExecutorService(org.glassfish.concurrent.config.ManagedScheduledExecutorService) DefaultManagedScheduledExecutorService(org.glassfish.concurrent.runtime.deployer.DefaultManagedScheduledExecutorService)

Example 3 with ManagedScheduledExecutorService

use of org.glassfish.concurrent.config.ManagedScheduledExecutorService in project Payara by payara.

the class ManagedScheduledExecutorServiceManager method createConfigBean.

protected ManagedExecutorServiceBase createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
    ManagedScheduledExecutorService managedExecutorService = param.createChild(ManagedScheduledExecutorService.class);
    setAttributesOnConfigBean(managedExecutorService, properties);
    return managedExecutorService;
}
Also used : ManagedScheduledExecutorService(org.glassfish.concurrent.config.ManagedScheduledExecutorService)

Example 4 with ManagedScheduledExecutorService

use of org.glassfish.concurrent.config.ManagedScheduledExecutorService in project Payara by payara.

the class ManagedScheduledExecutorServiceDeployer method undeployResource.

@Override
public void undeployResource(Object resource) throws Exception {
    ManagedScheduledExecutorService ManagedScheduledExecutorServiceResource = (ManagedScheduledExecutorService) resource;
    ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(ManagedScheduledExecutorServiceResource);
    undeployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ManagedScheduledExecutorService(org.glassfish.concurrent.config.ManagedScheduledExecutorService)

Example 5 with ManagedScheduledExecutorService

use of org.glassfish.concurrent.config.ManagedScheduledExecutorService in project Payara by payara.

the class ManagedScheduledExecutorServiceDeployer method deployResource.

@Override
public void deployResource(Object resource) throws Exception {
    ManagedScheduledExecutorService ManagedScheduledExecutorServiceResource = (ManagedScheduledExecutorService) resource;
    ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(ManagedScheduledExecutorServiceResource);
    deployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ManagedScheduledExecutorService(org.glassfish.concurrent.config.ManagedScheduledExecutorService)

Aggregations

ManagedScheduledExecutorService (org.glassfish.concurrent.config.ManagedScheduledExecutorService)6 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)4 NamingException (javax.naming.NamingException)1 RefAddr (javax.naming.RefAddr)1 ActionReport (org.glassfish.api.ActionReport)1 DefaultResourceProxy (org.glassfish.api.naming.DefaultResourceProxy)1 DefaultManagedScheduledExecutorService (org.glassfish.concurrent.runtime.deployer.DefaultManagedScheduledExecutorService)1 SerializableObjectRefAddr (org.glassfish.resources.naming.SerializableObjectRefAddr)1