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:
@@ -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.
|
||||
@@ -31,6 +31,10 @@ import org.springframework.util.ReflectionUtils;
|
||||
* {@link org.springframework.scheduling.commonj.WorkManagerTaskExecutor}
|
||||
* adapter for WebLogic and WebSphere.
|
||||
*
|
||||
* <p>Note: On GlassFish 4 and higher, a
|
||||
* {@link org.springframework.scheduling.concurrent.DefaultManagedTaskExecutor}
|
||||
* should be preferred, following JSR-236 support in Java EE 7.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5.2
|
||||
*/
|
||||
@@ -43,12 +47,12 @@ public class GlassFishWorkManagerTaskExecutor extends WorkManagerTaskExecutor {
|
||||
|
||||
public GlassFishWorkManagerTaskExecutor() {
|
||||
try {
|
||||
Class wmf = getClass().getClassLoader().loadClass(WORK_MANAGER_FACTORY_CLASS);
|
||||
this.getWorkManagerMethod = wmf.getMethod("getWorkManager", new Class[] {String.class});
|
||||
Class<?> wmf = getClass().getClassLoader().loadClass(WORK_MANAGER_FACTORY_CLASS);
|
||||
this.getWorkManagerMethod = wmf.getMethod("getWorkManager", String.class);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(
|
||||
"Could not initialize GlassFishWorkManagerTaskExecutor because GlassFish API is not available: " + ex);
|
||||
"Could not initialize GlassFishWorkManagerTaskExecutor because GlassFish API is not available", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 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.
|
||||
@@ -29,10 +29,19 @@ import org.springframework.jca.work.WorkManagerTaskExecutor;
|
||||
* {@link org.springframework.scheduling.commonj.WorkManagerTaskExecutor}
|
||||
* adapter for WebLogic and WebSphere.
|
||||
*
|
||||
* <p>This class does not work on JBoss 7 or higher. There is no known
|
||||
* immediate replacement, since JBoss does not want its JCA WorkManager
|
||||
* to be exposed anymore. As of JBoss/WildFly 8, a
|
||||
* {@link org.springframework.scheduling.concurrent.DefaultManagedTaskExecutor}
|
||||
* may be used, following JSR-236 support in Java EE 7.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5.2
|
||||
* @see org.jboss.resource.work.JBossWorkManagerMBean
|
||||
* @deprecated as of Spring 4.0, since there are no fully supported versions
|
||||
* of JBoss that this class works with anymore
|
||||
*/
|
||||
@Deprecated
|
||||
public class JBossWorkManagerTaskExecutor extends WorkManagerTaskExecutor {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 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.
|
||||
@@ -31,7 +31,10 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5.2
|
||||
* @deprecated as of Spring 4.0, since there are no fully supported versions
|
||||
* of JBoss that this class works with anymore
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class JBossWorkManagerUtils {
|
||||
|
||||
private static final String JBOSS_WORK_MANAGER_MBEAN_CLASS_NAME = "org.jboss.resource.work.JBossWorkManagerMBean";
|
||||
@@ -69,7 +72,7 @@ public abstract class JBossWorkManagerUtils {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(
|
||||
"Could not initialize JBossWorkManagerTaskExecutor because JBoss API is not available: " + ex);
|
||||
"Could not initialize JBossWorkManagerTaskExecutor because JBoss API is not available", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user