Added convenience classes for typical JSR-236 setup in a Java EE 7 environment

Introduced DefaultManagedTaskExecutor, DefaultManagedTaskScheduler and DefaultManagedAwareThreadFactory classes, revised related javadoc, and deprecated unsupported JBossWorkManagerTaskExecutor in favor of JSR-236 setup on WildFly 8.

Issue: SPR-8195
This commit is contained in:
Juergen Hoeller
2013-11-02 20:14:02 +01:00
parent 00474ceecd
commit 49758a2a96
10 changed files with 356 additions and 51 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +17,9 @@
package org.springframework.scheduling.commonj;
import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.Callable;
import javax.naming.NamingException;
import commonj.work.Work;
@@ -53,17 +52,9 @@ import org.springframework.util.Assert;
* <p>The CommonJ WorkManager will usually be retrieved from the application
* server's JNDI environment, as defined in the server's management console.
*
* <p><b>Note: At the time of this writing, the CommonJ WorkManager facility
* is only supported on IBM WebSphere 6.0+ and BEA WebLogic 9.0+,
* despite being such a crucial API for an application server.</b>
* (There is a similar facility available on WebSphere 5.1 Enterprise,
* though, which we will discuss below.)
*
* <p><b>On JBoss and GlassFish, a similar facility is available through
* the JCA WorkManager.</b> See the
* {@link org.springframework.jca.work.jboss.JBossWorkManagerTaskExecutor}
* {@link org.springframework.jca.work.glassfish.GlassFishWorkManagerTaskExecutor}
* classes which are the direct equivalent of this CommonJ adapter class.
* <p>Note: On the upcoming EE 7 compliant versions of WebLogic and WebSphere, a
* {@link org.springframework.scheduling.concurrent.DefaultManagedTaskExecutor}
* should be preferred, following JSR-236 support in Java EE 7.
*
* @author Juergen Hoeller
* @since 2.0
@@ -80,8 +71,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
/**
* Specify the CommonJ WorkManager to delegate to.
* <p>Alternatively, you can also specify the JNDI name
* of the target WorkManager.
* <p>Alternatively, you can also specify the JNDI name of the target WorkManager.
* @see #setWorkManagerName
*/
public void setWorkManager(WorkManager workManager) {
@@ -90,9 +80,8 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
/**
* Set the JNDI name of the CommonJ WorkManager.
* <p>This can either be a fully qualified JNDI name,
* or the JNDI name relative to the current environment
* naming context if "resourceRef" is set to "true".
* <p>This can either be a fully qualified JNDI name, or the JNDI name relative
* to the current environment naming context if "resourceRef" is set to "true".
* @see #setWorkManager
* @see #setResourceRef
*/
@@ -177,30 +166,22 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
//-------------------------------------------------------------------------
@Override
public WorkItem schedule(Work work)
throws WorkException, IllegalArgumentException {
public WorkItem schedule(Work work) throws WorkException, IllegalArgumentException {
return this.workManager.schedule(work);
}
@Override
public WorkItem schedule(Work work, WorkListener workListener)
throws WorkException, IllegalArgumentException {
public WorkItem schedule(Work work, WorkListener workListener) throws WorkException {
return this.workManager.schedule(work, workListener);
}
@Override
public boolean waitForAll(Collection workItems, long timeout)
throws InterruptedException, IllegalArgumentException {
public boolean waitForAll(Collection workItems, long timeout) throws InterruptedException {
return this.workManager.waitForAll(workItems, timeout);
}
@Override
public Collection waitForAny(Collection workItems, long timeout)
throws InterruptedException, IllegalArgumentException {
public Collection waitForAny(Collection workItems, long timeout) throws InterruptedException {
return this.workManager.waitForAny(workItems, timeout);
}