You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/03/07 20:56:28 UTC
svn commit: r634792 [8/9] - in /geronimo/sandbox/concurrent: ./
concurrent-deployer/ concurrent-deployer/src/ concurrent-deployer/src/main/
concurrent-deployer/src/main/plan/ concurrent/ concurrent/src/
concurrent/src/main/ concurrent/src/main/plan/ ge...
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/executor/ServerManagedThreadFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/executor/ServerManagedThreadFactory.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/executor/ServerManagedThreadFactory.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/executor/ServerManagedThreadFactory.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.executor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+import javax.util.concurrent.ManagedThreadFactory;
+
+import org.apache.geronimo.concurrent.impl.NotificationHelper;
+import org.apache.geronimo.concurrent.impl.thread.GeronimoManagedThread;
+import org.apache.geronimo.concurrent.impl.thread.GeronimoManagedThreadFactory;
+import org.apache.geronimo.concurrent.impl.thread.ManagedThreadGBean;
+import org.apache.geronimo.concurrent.thread.ManagedThread;
+import org.apache.geronimo.concurrent.thread.ThreadStoppedListener;
+import org.apache.geronimo.management.ManagedConstants;
+
+/**
+ * ThreadFactory to be used within
+ * ServerManagedExecutorService or ServerManagedScheduledExecutorService.
+ */
+public class ServerManagedThreadFactory
+ implements ManagedThreadFactory, ThreadStoppedListener {
+
+ private GeronimoManagedThreadFactory factory;
+ private NotificationHelper notificationHelper;
+
+ private List<ManagedThread> threads =
+ Collections.synchronizedList(new ArrayList<ManagedThread>());
+
+ public ServerManagedThreadFactory(GeronimoManagedThreadFactory factory,
+ NotificationHelper notificationHelper) {
+ this.factory = factory;
+ this.notificationHelper = notificationHelper;
+ }
+
+ private void sendNotification(ManagedThreadGBean threadGBean) {
+ if (this.notificationHelper.isNotificationSupported()) {
+ Properties userData = new Properties();
+ userData.setProperty("managedthread", threadGBean.getObjectName());
+
+ this.notificationHelper.sendNotification(ManagedConstants.NEW_THREAD_EVENT, userData);
+ }
+ }
+
+ public Thread newThread(Runnable runnable) {
+ GeronimoManagedThread thread = (GeronimoManagedThread)this.factory.newThread(runnable);
+
+ // set listener so that this class gets notifications of thread stop
+ thread.setThreadStoppedListener(this);
+
+ this.threads.add(thread);
+
+ // send JMX notification
+ sendNotification(thread.getGbean());
+
+ return thread;
+ }
+
+ public void threadStopped(Thread thread) {
+ this.threads.remove(thread);
+ this.factory.threadStopped(thread);
+ }
+
+ private List<ManagedThread> getThreadList() {
+ synchronized(this.threads) {
+ return new ArrayList<ManagedThread>(this.threads);
+ }
+ }
+
+ public String[] getEventTypes() {
+ return new String[] { ManagedConstants.NEW_THREAD_EVENT };
+ }
+
+ public String[] getThreads() {
+ return GeronimoManagedThreadFactory.getThreads(getThreadList());
+ }
+
+ public String[] getHungTaskThreads() {
+ return GeronimoManagedThreadFactory.getHungTaskThreads(getThreadList());
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/executor/ServerManagedThreadFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/executor/ServerManagedThreadFactory.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/NamingContextHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/NamingContextHandler.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/NamingContextHandler.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/NamingContextHandler.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.handlers;
+
+import java.util.Map;
+
+import javax.naming.Context;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.concurrent.ManagedContextHandler;
+import org.apache.geronimo.naming.java.RootContext;
+
+/**
+ * Geronimo naming context handler.
+ */
+public class NamingContextHandler implements ManagedContextHandler {
+
+ private final static Log LOG = LogFactory.getLog(NamingContextHandler.class);
+
+ private final static String OLD_CONTEXT =
+ NamingContextHandler.class.getName() + ".oldContext";
+
+ private final static String NEW_CONTEXT =
+ NamingContextHandler.class.getName() + ".newContext";
+
+ public void saveContext(Map<String, Object> context) {
+ LOG.debug("saveContext");
+
+ context.put(NEW_CONTEXT,
+ RootContext.getComponentContext());
+ }
+
+ public void setContext(Map<String, Object> threadContext) {
+ LOG.debug("setContext");
+
+ // save existing context
+ threadContext.put(OLD_CONTEXT,
+ RootContext.getComponentContext());
+
+ // set new context
+ Context context = (Context)threadContext.get(NEW_CONTEXT);
+ RootContext.setComponentContext(context);
+ }
+
+ public void unsetContext(Map<String, Object> threadContext) {
+ LOG.debug("unsetContext");
+
+ // restore old context
+ Context context = (Context)threadContext.get(OLD_CONTEXT);
+ RootContext.setComponentContext(context);
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/NamingContextHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/NamingContextHandler.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/SecurityContextHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/SecurityContextHandler.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/SecurityContextHandler.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/SecurityContextHandler.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.handlers;
+
+import java.util.Map;
+
+import javax.security.jacc.PolicyContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.concurrent.ManagedContextHandler;
+import org.apache.geronimo.security.Callers;
+import org.apache.geronimo.security.ContextManager;
+
+/*
+ * Security context handler.
+ */
+public class SecurityContextHandler implements ManagedContextHandler {
+
+ private final static Log LOG = LogFactory.getLog(SecurityContextHandler.class);
+
+ private final static String OLD_CALLERS =
+ SecurityContextHandler.class.getName() + ".oldCallers";
+
+ private final static String OLD_CONTEXT_ID =
+ SecurityContextHandler.class.getName() + ".oldContextId";
+
+ private final static String NEW_CALLERS =
+ SecurityContextHandler.class.getName() + ".newCallers";
+
+ private final static String NEW_CONTEXT_ID =
+ SecurityContextHandler.class.getName() + ".newContextId";
+
+ public void saveContext(Map<String, Object> context) {
+ LOG.debug("saveContext");
+
+ context.put(NEW_CONTEXT_ID,
+ PolicyContext.getContextID());
+ context.put(NEW_CALLERS,
+ ContextManager.getCallers());
+ }
+
+ public void setContext(Map<String, Object> threadContext) {
+ LOG.debug("setContext");
+
+ // save existing security info
+ threadContext.put(OLD_CONTEXT_ID,
+ PolicyContext.getContextID());
+ threadContext.put(OLD_CALLERS,
+ ContextManager.getCallers());
+
+ // set new security info
+ String contextId = (String)threadContext.get(NEW_CONTEXT_ID);
+ Callers callers = (Callers)threadContext.get(NEW_CALLERS);
+
+ PolicyContext.setContextID(contextId);
+ ContextManager.popCallers(callers); // works like setCallers()
+ }
+
+ public void unsetContext(Map<String, Object> threadContext) {
+ LOG.debug("unsetContext");
+
+ // restore old security info
+ String contextId = (String)threadContext.get(OLD_CONTEXT_ID);
+ Callers callers = (Callers)threadContext.get(OLD_CALLERS);
+
+ PolicyContext.setContextID(contextId);
+ ContextManager.popCallers(callers); // works like setCallers()
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/SecurityContextHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/handlers/SecurityContextHandler.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThread.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThread.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThread.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThread.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.thread;
+
+import org.apache.geronimo.concurrent.thread.ManagedThread;
+import org.apache.geronimo.concurrent.thread.ThreadStoppedListener;
+
+public class GeronimoManagedThread extends ManagedThread {
+
+ // gbean that manages this object
+ private ManagedThreadGBean gbean;
+
+ public GeronimoManagedThread(ThreadGroup group,
+ Runnable runnable,
+ String name,
+ ThreadStoppedListener threadStoppedListener) {
+ super(group, runnable, name, threadStoppedListener);
+ }
+
+ public ManagedThreadGBean getGbean() {
+ return gbean;
+ }
+
+ protected void setGbean(ManagedThreadGBean gbean) {
+ this.gbean = gbean;
+ }
+
+ @Override
+ protected synchronized void setState(TaskState newState) {
+ this.gbean.sendNotification(newState);
+ super.setState(newState);
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThread.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThread.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactory.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactory.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactory.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,139 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.thread;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.geronimo.concurrent.thread.AbstractManagedThreadFactory;
+import org.apache.geronimo.concurrent.thread.ManagedThread;
+
+public class GeronimoManagedThreadFactory extends AbstractManagedThreadFactory {
+
+ // gbean that manages this object
+ private ManagedThreadFactoryGBean factoryGBean;
+
+ private HungTaskMonitor hungTaskMonitor;
+ private long hungTaskMonitorFrequency = 1000 * 60; // 1 minute
+
+ public GeronimoManagedThreadFactory(ManagedThreadFactoryGBean gbean) {
+ this.factoryGBean = gbean;
+ }
+
+ public void setHungTaskMonitorFrequency(long newFrequency) {
+ if (newFrequency <= 0) {
+ throw new IllegalArgumentException("Frequency must be greater than 0");
+ }
+ this.hungTaskMonitorFrequency = newFrequency;
+ }
+
+ public long getHungTaskMonitorFrequency() {
+ return this.hungTaskMonitorFrequency;
+ }
+
+ @Override
+ protected ManagedThread createThread(ThreadGroup group, Runnable runnable, String name) {
+ GeronimoManagedThread managedThread =
+ new GeronimoManagedThread(group, runnable, name, this);
+
+ // add gbean for the thread
+ this.factoryGBean.addThreadGBean(managedThread);
+
+ startHungTaskMonitor();
+
+ return managedThread;
+ }
+
+ @Override
+ public void threadStopped(Thread thread) {
+ super.threadStopped(thread);
+
+ // remove gbean fro the thread
+ GeronimoManagedThread managedThread = (GeronimoManagedThread)thread;
+ this.factoryGBean.removeThreadGBean(managedThread);
+ }
+
+ public String[] getThreads() {
+ return getThreads(getThreadList());
+ }
+
+ public String[] getHungTaskThreads() {
+ return getHungTaskThreads(getThreadList());
+ }
+
+ public static String[] getThreads(List<ManagedThread> threadList) {
+ int size = threadList.size();
+ String [] threadNames = new String[size];
+ for (int i = 0; i < size; i++) {
+ GeronimoManagedThread thread = (GeronimoManagedThread)threadList.get(i);
+ threadNames[i] = thread.getGbean().getObjectName();
+ }
+ return threadNames;
+ }
+
+ public static String[] getHungTaskThreads(List<ManagedThread> threadList) {
+ int size = threadList.size();
+ List<String> hungTaskThreads = new ArrayList<String>();
+ for (int i = 0; i < size; i++) {
+ GeronimoManagedThread thread = (GeronimoManagedThread)threadList.get(i);
+ if (thread.isTaskHung()) {
+ hungTaskThreads.add(thread.getGbean().getObjectName());
+ }
+ }
+ return hungTaskThreads.toArray(new String[hungTaskThreads.size()]);
+ }
+
+ private synchronized void startHungTaskMonitor() {
+ if (this.hungTaskMonitor == null) {
+ this.hungTaskMonitor = new HungTaskMonitor();
+ this.hungTaskMonitor.setFrequency(this.hungTaskMonitorFrequency);
+ Thread thread = new Thread(this.threadGroup,
+ this.hungTaskMonitor,
+ "UpdateTaskStateThread");
+ thread.start();
+ }
+ }
+
+ private class HungTaskMonitor implements Runnable {
+ private long frequency = 1000 * 60; // 1 minute default
+ private boolean done = false;
+
+ public void setFrequency(long newFrequency) {
+ frequency = newFrequency;
+ }
+
+ public long getFrequency() {
+ return frequency;
+ }
+
+ public void stop() {
+ done = true;
+ }
+
+ public void run() {
+ while (!done) {
+ try {
+ Thread.sleep(frequency);
+ } catch (InterruptedException e) {
+ break;
+ }
+ updateStatus();
+ }
+ }
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactory.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactorySource.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactorySource.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactorySource.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactorySource.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.thread;
+
+public interface GeronimoManagedThreadFactorySource {
+
+ GeronimoManagedThreadFactory getManagedThreadFactory();
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactorySource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/GeronimoManagedThreadFactorySource.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryGBean.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryGBean.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryGBean.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,271 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.thread;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.concurrent.ManagedContextHandler;
+import org.apache.geronimo.concurrent.ManagedContextHandlerChain;
+import org.apache.geronimo.concurrent.impl.ContextHandlerUtils;
+import org.apache.geronimo.concurrent.impl.GBeanBuilder;
+import org.apache.geronimo.concurrent.impl.NotificationHelper;
+import org.apache.geronimo.concurrent.naming.ModuleAwareResourceSource;
+import org.apache.geronimo.concurrent.thread.ManagedThreadFactoryUtils;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.management.EventProvider;
+import org.apache.geronimo.management.ManagedConstants;
+
+public class ManagedThreadFactoryGBean
+ extends GBeanBuilder
+ implements GBeanLifecycle,
+ GeronimoManagedThreadFactorySource,
+ ModuleAwareResourceSource,
+ EventProvider,
+ org.apache.geronimo.management.ManagedThreadFactory {
+
+ private final static Log LOG = LogFactory.getLog(ManagedThreadFactoryGBean.class);
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ private AbstractName name;
+
+ private GeronimoManagedThreadFactory threadFactory;
+
+ private ManagedContextHandlerChain mainContextHandler;
+
+ private String groupName;
+ private boolean daemonThread;
+ private int threadPriority;
+ private long hungTaskThreshold;
+
+ private long hungTaskMonitorFrequency;
+
+ private NotificationHelper notificationHelper;
+
+ public ManagedThreadFactoryGBean(Kernel kernel,
+ ClassLoader classLoader,
+ AbstractName name,
+ String[] contextHandlerClasses,
+ String groupName,
+ int threadPriority,
+ boolean daemonThread,
+ long hungTaskThreshold,
+ long hungTaskMonitorFrequency) {
+ super(kernel, classLoader);
+ this.name = name;
+
+ this.notificationHelper = new NotificationHelper(kernel, name);
+
+ List<ManagedContextHandler> handlers =
+ ContextHandlerUtils.loadHandlers(classLoader, contextHandlerClasses);
+
+ this.mainContextHandler = new ManagedContextHandlerChain(handlers);
+
+ this.groupName = groupName;
+ this.daemonThread = daemonThread;
+ this.threadPriority = getThreadPriority(threadPriority);
+ this.hungTaskThreshold = hungTaskThreshold;
+ this.hungTaskMonitorFrequency = getHungTaskMonitorFrequency(hungTaskMonitorFrequency);
+ }
+
+ private static int getThreadPriority(int threadPriority) {
+ return (threadPriority <= 0) ? Thread.NORM_PRIORITY : threadPriority;
+ }
+
+ private static long getHungTaskMonitorFrequency(long hungTaskMonitorFrequency) {
+ return (hungTaskMonitorFrequency <= 0) ? 1000 * 60 : hungTaskMonitorFrequency;
+ }
+
+ private void sendNotification(ManagedThreadGBean threadGBean) {
+ if (this.notificationHelper.isNotificationSupported()) {
+ Properties userData = new Properties();
+ userData.setProperty("managedthread", threadGBean.getObjectName());
+
+ this.notificationHelper.sendNotification(ManagedConstants.NEW_THREAD_EVENT, userData);
+ }
+ }
+
+ protected void addThreadGBean(GeronimoManagedThread thread) {
+ AbstractName aName = kernel.getNaming().createRootName(name.getArtifact(), thread.getName(), ManagedConstants.MANAGED_THREAD);
+ GBeanData threadData = new GBeanData(aName, ManagedThreadGBean.getGBeanInfo());
+
+ try {
+ // use either addGBeanKernel() or addGBeanConfiguration()
+ addGBeanKernel(aName, threadData);
+
+ ManagedThreadGBean threadGBean = (ManagedThreadGBean)kernel.getGBean(aName);
+ threadGBean.verifyObjectName();
+
+ // let gbean know about the thread
+ threadGBean.setManagedThread(thread);
+ // let thread know about the gbean
+ thread.setGbean(threadGBean);
+
+ // send JMX notification
+ sendNotification(threadGBean);
+
+ } catch (Exception e) {
+ LOG.warn("Failed to add thread gbean", e);
+ }
+ }
+
+ protected void removeThreadGBean(GeronimoManagedThread thread) {
+ AbstractName gbeanName = thread.getGbean().getName();
+
+ removeGBeanKernel(gbeanName);
+ }
+
+ public synchronized GeronimoManagedThreadFactory getManagedThreadFactory() {
+ if (this.threadFactory == null) {
+ // create the factory
+ this.threadFactory = new GeronimoManagedThreadFactory(this);
+
+ this.threadFactory.setThreadGroup(groupName);
+ this.threadFactory.setDaemonThread(daemonThread);
+ this.threadFactory.setThreadPriority(getThreadPriority(threadPriority));
+ this.threadFactory.setHungTaskThreshold(hungTaskThreshold);
+ this.threadFactory.setHungTaskMonitorFrequency(getHungTaskMonitorFrequency(hungTaskMonitorFrequency));
+ }
+
+ return this.threadFactory;
+ }
+
+ public Object $getResource(AbstractName moduleID) {
+ GeronimoManagedThreadFactory threadFactory = getManagedThreadFactory();
+ return ManagedThreadFactoryUtils.createStandaloneThreadFactory(threadFactory,
+ this.mainContextHandler);
+ }
+
+ public void doStart() throws Exception {
+ }
+
+ public void doFail() {
+ if (this.threadFactory != null) {
+ this.threadFactory.shutdown();
+ }
+ }
+
+ public void doStop() throws Exception {
+ doFail();
+ }
+
+ public String[] getThreads() {
+ if (this.threadFactory != null) {
+ return this.threadFactory.getThreads();
+ } else {
+ return new String [] {};
+ }
+ }
+
+ public String[] getHungTaskThreads() {
+ if (this.threadFactory != null) {
+ return this.threadFactory.getHungTaskThreads();
+ } else {
+ return new String [] {};
+ }
+ }
+
+ public int getPriority() {
+ return this.threadPriority;
+ }
+
+ public boolean getDaemon() {
+ return this.daemonThread;
+ }
+
+ public long getHungTaskThreshold() {
+ return this.hungTaskThreshold;
+ }
+
+ public long getHungTaskMonitorFrequency() {
+ return this.hungTaskMonitorFrequency;
+ }
+
+ public AbstractName getName() {
+ return this.name;
+ }
+
+ public String getObjectName() {
+ return this.name.getObjectName().getCanonicalName();
+ }
+
+ public String[] getEventTypes() {
+ return new String[] { ManagedConstants.NEW_THREAD_EVENT };
+ }
+
+ public boolean isEventProvider() {
+ return true;
+ }
+
+ public boolean isStateManageable() {
+ return true;
+ }
+
+ public boolean isStatisticsProvider() {
+ return false;
+ }
+
+ protected void verifyObjectName() {
+ GBeanBuilder.verifyObjectName(getObjectName(),
+ ManagedConstants.MANAGED_THREAD_FACTORY,
+ ManagedConstants.MANAGED_THREAD_FACTORY);
+ }
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ManagedThreadFactoryGBean.class, ManagedConstants.MANAGED_THREAD_FACTORY);
+
+ infoFactory.addAttribute("classLoader", ClassLoader.class, false, false);
+ infoFactory.addAttribute("abstractName", AbstractName.class, false, false);
+ infoFactory.addAttribute("kernel", Kernel.class, false, false);
+
+ infoFactory.addAttribute("contextHandlers", String[].class, true, false);
+
+ infoFactory.addAttribute("groupName", String.class, true);
+ infoFactory.addAttribute("priority", int.class, true);
+ infoFactory.addAttribute("daemon", boolean.class, true);
+ infoFactory.addAttribute("hungTaskThreshold", long.class, true);
+ infoFactory.addAttribute("hungTaskMonitorFrequency", long.class, true);
+
+ infoFactory.addInterface(GeronimoManagedThreadFactorySource.class);
+ infoFactory.addInterface(org.apache.geronimo.management.ManagedThreadFactory.class);
+
+ infoFactory.setConstructor(new String[]{"kernel",
+ "classLoader",
+ "abstractName",
+ "contextHandlers",
+ "groupName",
+ "priority",
+ "daemon",
+ "hungTaskThreshold",
+ "hungTaskMonitorFrequency"});
+
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryGBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryGBean.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryWrapperGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryWrapperGBean.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryWrapperGBean.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryWrapperGBean.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,144 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.thread;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.concurrent.impl.GBeanBuilder;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.management.ManagedConstants;
+
+/**
+ * Deploys ManagedThreadFactoryGBean under the right JMX object name.
+ */
+public class ManagedThreadFactoryWrapperGBean
+ extends GBeanBuilder
+ implements GBeanLifecycle,
+ GeronimoManagedThreadFactorySource {
+
+ private final static Log LOG = LogFactory.getLog(ManagedThreadFactoryWrapperGBean.class);
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ private AbstractName name;
+
+ private String groupName;
+ private boolean daemonThread;
+ private int threadPriority;
+ private long hungTaskThreshold;
+ private long hungTaskMonitorFrequency;
+ private String[] contextHandlerClasses;
+
+ private AbstractName threadFactoryName;
+ private ManagedThreadFactoryGBean threadFactoryGBean;
+
+ public ManagedThreadFactoryWrapperGBean(Kernel kernel,
+ ClassLoader classLoader,
+ AbstractName name,
+ String[] contextHandlerClasses,
+ String groupName,
+ int threadPriority,
+ boolean daemonThread,
+ long hungTaskThreshold,
+ long hungTaskMonitorFrequency) {
+ super(kernel, classLoader);
+ this.name = name;
+
+ this.contextHandlerClasses = contextHandlerClasses;
+ this.groupName = groupName;
+ this.daemonThread = daemonThread;
+ this.threadPriority = threadPriority;
+ this.hungTaskThreshold = hungTaskThreshold;
+ this.hungTaskMonitorFrequency = hungTaskMonitorFrequency;
+ }
+
+ public GeronimoManagedThreadFactory getManagedThreadFactory() {
+ return (this.threadFactoryGBean == null) ? null : this.threadFactoryGBean.getManagedThreadFactory();
+ }
+
+ public void doStart() throws Exception {
+ String threadName = (String)this.name.getName().get("name");
+ this.threadFactoryName = kernel.getNaming().createRootName(name.getArtifact(), threadName, ManagedConstants.MANAGED_THREAD_FACTORY);
+ GBeanData threadFactoryData = new GBeanData(this.threadFactoryName, ManagedThreadFactoryGBean.getGBeanInfo());
+ threadFactoryData.setAttribute("contextHandlers", this.contextHandlerClasses);
+ threadFactoryData.setAttribute("groupName", this.groupName);
+ threadFactoryData.setAttribute("priority", this.threadPriority);
+ threadFactoryData.setAttribute("daemon", this.daemonThread);
+ threadFactoryData.setAttribute("hungTaskThreshold", this.hungTaskThreshold);
+ threadFactoryData.setAttribute("hungTaskMonitorFrequency", this.hungTaskMonitorFrequency);
+
+ addGBeanKernel(this.threadFactoryName, threadFactoryData);
+
+ this.threadFactoryGBean = (ManagedThreadFactoryGBean)kernel.getGBean(this.threadFactoryName);
+ this.threadFactoryGBean.verifyObjectName();
+ }
+
+ public void doFail() {
+ try {
+ doStop();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ public void doStop() throws Exception {
+ this.threadFactoryGBean = null;
+ if (this.threadFactoryName != null) {
+ removeGBeanKernel(this.threadFactoryName);
+ }
+ }
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ManagedThreadFactoryWrapperGBean.class, ManagedConstants.MANAGED_THREAD_FACTORY + "Builder");
+
+ infoFactory.addAttribute("classLoader", ClassLoader.class, false, false);
+ infoFactory.addAttribute("abstractName", AbstractName.class, false, false);
+ infoFactory.addAttribute("kernel", Kernel.class, false, false);
+
+ infoFactory.addAttribute("contextHandlers", String[].class, true, false);
+
+ infoFactory.addAttribute("groupName", String.class, true);
+ infoFactory.addAttribute("priority", int.class, true);
+ infoFactory.addAttribute("daemon", boolean.class, true);
+ infoFactory.addAttribute("hungTaskThreshold", long.class, true);
+ infoFactory.addAttribute("hungTaskMonitorFrequency", long.class, true);
+
+ infoFactory.addInterface(GeronimoManagedThreadFactorySource.class);
+
+ infoFactory.setConstructor(new String[]{"kernel",
+ "classLoader",
+ "abstractName",
+ "contextHandlers",
+ "groupName",
+ "priority",
+ "daemon",
+ "hungTaskThreshold",
+ "hungTaskMonitorFrequency"});
+
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryWrapperGBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadFactoryWrapperGBean.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadGBean.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadGBean.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadGBean.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,209 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.concurrent.impl.thread;
+
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.concurrent.impl.GBeanBuilder;
+import org.apache.geronimo.concurrent.impl.NotificationHelper;
+import org.apache.geronimo.concurrent.thread.ManagedThread;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.management.EventProvider;
+import org.apache.geronimo.management.ManagedConstants;
+
+public class ManagedThreadGBean implements GBeanLifecycle, EventProvider, org.apache.geronimo.management.ManagedThread {
+
+ private final static Log LOG = LogFactory.getLog(ManagedThreadGBean.class);
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ private AbstractName name;
+ private ManagedThread thread;
+
+ private NotificationHelper notificationHelper;
+
+ public ManagedThreadGBean(Kernel kernel,
+ ClassLoader classLoader,
+ AbstractName name) {
+ this.name = name;
+
+ this.notificationHelper = new NotificationHelper(kernel, name);
+ }
+
+ protected void sendNotification(ManagedThread.TaskState state) {
+ if (this.notificationHelper.isNotificationSupported()) {
+ String type = null;
+ if (state == ManagedThread.TaskState.CANCELLED) {
+ type = ManagedConstants.TASK_CANCELLED_STATE;
+ } else if (state == ManagedThread.TaskState.RELEASED) {
+ type = ManagedConstants.TASK_RELEASED_STATE;
+ } else if (state == ManagedThread.TaskState.HUNG) {
+ type = ManagedConstants.TASK_HUNG_STATE;
+ } else {
+ // no notifications on other states
+ return;
+ }
+
+ // TODO: 1) might need to properly synchronize to get accurate info
+ // 2) some info only set on certain events?
+
+ Properties userData = new Properties();
+ userData.setProperty("managedthread",
+ getObjectName());
+ userData.setProperty("managedthread.threadID",
+ String.valueOf(getThreadID()));
+ userData.setProperty("managedthread.threadName",
+ getThreadName());
+ userData.setProperty("managedthread.taskRunTime",
+ String.valueOf(getTaskRunTime()));
+ String taskDescription = getTaskIdentityDescription();
+ if (taskDescription != null) {
+ userData.setProperty("managedthread.taskIdentityDescription",
+ taskDescription);
+ }
+ String taskName = getTaskIdentityName();
+ if (taskName != null) {
+ userData.setProperty("managedthread.taskIdentityName",
+ taskName);
+ }
+
+ this.notificationHelper.sendNotification(type, userData);
+ }
+ }
+
+ protected void setManagedThread(ManagedThread thread) {
+ this.thread = thread;
+ }
+
+ public void doFail() {
+ this.thread = null;
+ }
+
+ public void doStart() throws Exception {
+ LOG.debug("Thread gbean started: " + this.thread);
+ }
+
+ public void doStop() throws Exception {
+ LOG.debug("Thread gbean stopped: " + this.thread);
+ this.thread = null;
+ }
+
+ public boolean cancel() {
+ return (this.thread == null) ? false : this.thread.cancelTask();
+ }
+
+ public long getHungTaskThreshold() {
+ return (this.thread == null) ? -1 : this.thread.getHungTaskThreshold();
+ }
+
+ public void setHungTaskThreshold(long threshold) {
+ if (this.thread != null) {
+ this.thread.setHungTaskThreshold(threshold);
+ }
+ }
+
+ public String getTaskIdentityDescription() {
+ return (this.thread == null) ? null : this.thread.getTaskIdentityDescription();
+ }
+
+ public String getTaskIdentityDescription(String locale) {
+ return (this.thread == null) ? null : this.thread.getTaskIdentityDescription(locale);
+ }
+
+ public String getTaskIdentityName() {
+ return (this.thread == null) ? null : this.thread.getTaskIdentityName();
+ }
+
+ public long getTaskRunTime() {
+ return (this.thread == null) ? 0 : this.thread.getTaskRunTime();
+ }
+
+ public long getThreadID() {
+ return (this.thread == null) ? -1 : this.thread.getThreadID();
+ }
+
+ public String getThreadName() {
+ return (this.thread == null) ? null : this.thread.getThreadName();
+ }
+
+ public boolean isTaskCancelled() {
+ return (this.thread == null) ? false : this.thread.isTaskCancelled();
+ }
+
+ public boolean isTaskHung() {
+ return (this.thread == null) ? false : this.thread.isTaskHung();
+ }
+
+ public AbstractName getName() {
+ return this.name;
+ }
+
+ public String getObjectName() {
+ return this.name.getObjectName().getCanonicalName();
+ }
+
+ public String[] getEventTypes() {
+ return new String[] { ManagedConstants.TASK_HUNG_STATE,
+ ManagedConstants.TASK_CANCELLED_STATE,
+ ManagedConstants.TASK_RELEASED_STATE };
+ }
+
+ public boolean isEventProvider() {
+ return true;
+ }
+
+ public boolean isStateManageable() {
+ return true;
+ }
+
+ public boolean isStatisticsProvider() {
+ return false;
+ }
+
+ protected void verifyObjectName() {
+ GBeanBuilder.verifyObjectName(getObjectName(),
+ ManagedConstants.MANAGED_THREAD,
+ ManagedConstants.MANAGED_THREAD);
+ }
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ManagedThreadGBean.class, ManagedConstants.MANAGED_THREAD);
+
+ infoFactory.addAttribute("classLoader", ClassLoader.class, false, false);
+ infoFactory.addAttribute("abstractName", AbstractName.class, false, false);
+ infoFactory.addAttribute("kernel", Kernel.class, false, false);
+
+ infoFactory.addInterface(org.apache.geronimo.management.ManagedThread.class);
+
+ infoFactory.setConstructor(new String[]{"kernel",
+ "classLoader",
+ "abstractName"});
+
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadGBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/impl/thread/ManagedThreadGBean.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ModuleAwareResourceSource.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ModuleAwareResourceSource.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ModuleAwareResourceSource.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ModuleAwareResourceSource.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.concurrent.naming;
+
+import org.apache.geronimo.gbean.AbstractName;
+
+/**
+ * @version $Rev: 607943 $ $Date: 2008/02/28 21:05:44 $
+ */
+public interface ModuleAwareResourceSource {
+
+ Object $getResource(AbstractName moduleID);
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ModuleAwareResourceSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ModuleAwareResourceSource.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReference.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReference.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReference.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReference.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.concurrent.naming;
+
+import javax.naming.NamingException;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.xbean.naming.reference.SimpleReference;
+
+/**
+ * @version $Rev: 608311 $ $Date: 2008/02/28 21:05:44 $
+ */
+public class ResourceReference extends SimpleReference {
+ private final ModuleAwareResourceSource source;
+ private final String type;
+ private final AbstractName moduleID;
+
+ public ResourceReference(ModuleAwareResourceSource source, String type, AbstractName moduleID) {
+ this.source = source;
+ this.type = type;
+ this.moduleID = moduleID;
+ }
+
+ public Object getContent() throws NamingException {
+ try {
+ return this.source.$getResource(this.moduleID);
+ } catch (Throwable e) {
+ throw (NamingException)new NamingException("Could not create resource").initCause(e);
+ }
+ }
+
+ @Override
+ public String getClassName() {
+ return this.type;
+ }
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReference.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReference.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReferenceFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReferenceFactory.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReferenceFactory.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReferenceFactory.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.concurrent.naming;
+
+import javax.naming.NamingException;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.naming.reference.AbstractEntryFactory;
+
+/**
+ * @version $Rev: 608311 $ $Date: 2008/02/28 21:05:44 $
+ */
+public class ResourceReferenceFactory extends AbstractEntryFactory<ResourceReference, ModuleAwareResourceSource> {
+
+ private final String type;
+ private final AbstractName moduleID;
+
+ public ResourceReferenceFactory(Artifact[] configId, AbstractNameQuery abstractNameQuery, Class targetClass, AbstractName moduleID) {
+ super(configId, abstractNameQuery, ModuleAwareResourceSource.class);
+ this.type = targetClass.getName();
+ this.moduleID = moduleID;
+ }
+
+ public ResourceReference buildEntry(Kernel kernel, ClassLoader classLoader) throws NamingException {
+ ModuleAwareResourceSource source = getGBean(kernel);
+ return new ResourceReference(source, this.type, this.moduleID);
+ }
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReferenceFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent/src/main/java/org/apache/geronimo/concurrent/naming/ResourceReferenceFactory.java
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent_spec/LICENSE.TXT
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent_spec/LICENSE.TXT?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent_spec/LICENSE.TXT (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent_spec/LICENSE.TXT Fri Mar 7 11:56:14 2008
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: geronimo/sandbox/concurrent/geronimo-concurrent_spec/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent_spec/NOTICE.txt?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent_spec/NOTICE.txt (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent_spec/NOTICE.txt Fri Mar 7 11:56:14 2008
@@ -0,0 +1,6 @@
+Apache Geronimo
+Copyright 2003-2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent_spec/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent_spec/NOTICE.txt
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent_spec/pom.xml?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent_spec/pom.xml (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent_spec/pom.xml Fri Mar 7 11:56:14 2008
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<!-- $Rev: 487122 $ $Date: 2008/03/04 22:02:05 $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>specs</artifactId>
+ <version>1.2</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>geronimo-concurrent_spec</artifactId>
+ <name>Concurrency Utilities for Java EE: Specification API</name>
+ <version>1.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.geronimo.genesis.plugins</groupId>
+ <artifactId>tools-maven-plugin</artifactId>
+
+ <!-- Tools includes custom packagings, install as extension to pick them up -->
+ <extensions>true</extensions>
+
+ <executions>
+ <execution>
+ <id>install-legal-files</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>copy-legal-files</goal>
+ </goals>
+ <configuration>
+ <!-- Fail the build if no legal files were copied -->
+ <strict>true</strict>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>verify-legal-files</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>verify-legal-files</goal>
+ </goals>
+ <configuration>
+ <!-- Fail the build if no legal files were found -->
+ <strict>false</strict>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent_spec/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent_spec/pom.xml
------------------------------------------------------------------------------
svn:executable =
Added: geronimo/sandbox/concurrent/geronimo-concurrent_spec/src/main/java/javax/util/concurrent/AbortedException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent_spec/src/main/java/javax/util/concurrent/AbortedException.java?rev=634792&view=auto
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent_spec/src/main/java/javax/util/concurrent/AbortedException.java (added)
+++ geronimo/sandbox/concurrent/geronimo-concurrent_spec/src/main/java/javax/util/concurrent/AbortedException.java Fri Mar 7 11:56:14 2008
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.util.concurrent;
+
+import java.util.concurrent.ExecutionException;
+
+/**
+ * Exception indicating that the result of a value-producing task, cannot be retrieved because the
+ * task run was aborted.<p>
+ *
+ * Use the {@link java.lang.Throwable#getCause()} method to determine why the task aborted.
+ */
+public class AbortedException extends ExecutionException {
+
+ private static final long serialVersionUID = 8313294757663362709L;
+
+ /**
+ * Constructs an AbortedException with <code>null</code> as its detail message.
+ * The cause is not initialized, and may subsequently be initialized by a call to
+ * {@link java.lang.Throwable#initCause(java.lang.Throwable)}.
+ */
+ public AbortedException() {
+ super();
+ }
+
+ /**
+ * Constructs an AbortedException exception with the specified detail message and cause.<p>
+ *
+ * Note that the detail message associated with cause is not automatically incorporated in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval by the {@link java.lang.Throwable#getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the {@link java.lang.Throwable#getCause()} method).
+ * (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public AbortedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs an AbortedException exception with the specified detail message.<p>
+ *
+ * The cause is not initialized, and may subsequently be initialized by a call to
+ * {@link java.lang.Throwable#initCause(java.lang.Throwable)}.
+ *
+ * @param message the detail message (which is saved for later retrieval by the {@link java.lang.Throwable#getMessage()} method).
+ */
+ public AbortedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs an AbortedException exception with the specified cause and a
+ * detail message of (cause==null ? null : cause.toString())
+ * (which typically contains the class and detail message of cause).
+ *
+ * @param cause the cause (which is saved for later retrieval by the {@link java.lang.Throwable#getCause()} method).
+ * (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public AbortedException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: geronimo/sandbox/concurrent/geronimo-concurrent_spec/src/main/java/javax/util/concurrent/AbortedException.java
------------------------------------------------------------------------------
svn:eol-style = native