001/*
002 * Copyright 2002-2013 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.jca.work.jboss;
018
019import javax.resource.spi.work.WorkManager;
020
021import org.springframework.jca.work.WorkManagerTaskExecutor;
022
023/**
024 * Spring TaskExecutor adapter for the JBoss JCA WorkManager.
025 * Can be defined in web applications to make a TaskExecutor reference
026 * available, talking to the JBoss WorkManager (thread pool) underneath.
027 *
028 * <p>This is the JBoss equivalent of the CommonJ
029 * {@link org.springframework.scheduling.commonj.WorkManagerTaskExecutor}
030 * adapter for WebLogic and WebSphere.
031 *
032 * <p>This class does not work on JBoss 7 or higher. There is no known
033 * immediate replacement, since JBoss does not want its JCA WorkManager
034 * to be exposed anymore. As of JBoss/WildFly 8, a
035 * {@link org.springframework.scheduling.concurrent.DefaultManagedTaskExecutor}
036 * may be used, following JSR-236 support in Java EE 7.
037 *
038 * @author Juergen Hoeller
039 * @since 2.5.2
040 * @see org.jboss.resource.work.JBossWorkManagerMBean
041 * @deprecated as of Spring 4.0, since there are no fully supported versions
042 * of JBoss that this class works with anymore
043 */
044@Deprecated
045public class JBossWorkManagerTaskExecutor extends WorkManagerTaskExecutor {
046
047        /**
048         * Identify a specific JBossWorkManagerMBean to talk to,
049         * through its JMX object name.
050         * <p>The default MBean name is "jboss.jca:service=WorkManager".
051         * @see JBossWorkManagerUtils#getWorkManager(String)
052         */
053        public void setWorkManagerMBeanName(String mbeanName) {
054                setWorkManager(JBossWorkManagerUtils.getWorkManager(mbeanName));
055        }
056
057        /**
058         * Obtains the default JBoss JCA WorkManager through a JMX lookup
059         * for the JBossWorkManagerMBean.
060         * @see JBossWorkManagerUtils#getWorkManager()
061         */
062        @Override
063        protected WorkManager getDefaultWorkManager() {
064                return JBossWorkManagerUtils.getWorkManager();
065        }
066
067}