You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by lh...@apache.org on 2010/10/12 20:31:17 UTC
svn commit: r1021876 - in /servicemix/utils/trunk: ./
src/main/java/org/apache/servicemix/executors/impl/
Author: lhein
Date: Tue Oct 12 18:31:16 2010
New Revision: 1021876
URL: http://svn.apache.org/viewvc?rev=1021876&view=rev
Log:
setup mbeans for executors (see SM-2001 and SMX4-606)
Added:
servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutor.java
servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutorMBean.java
servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/WrappedRejectedExecutionHandler.java
Modified:
servicemix/utils/trunk/pom.xml
servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorFactoryImpl.java
servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorImpl.java
Modified: servicemix/utils/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/utils/trunk/pom.xml?rev=1021876&r1=1021875&r2=1021876&view=diff
==============================================================================
--- servicemix/utils/trunk/pom.xml (original)
+++ servicemix/utils/trunk/pom.xml Tue Oct 12 18:31:16 2010
@@ -1,380 +1,387 @@
<?xml version="1.0" encoding="UTF-8"?>
-<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">
+<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">
-<!--
+ <!--
- 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.
--->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicemix</groupId>
- <artifactId>servicemix-pom</artifactId>
- <version>4</version>
- </parent>
-
- <artifactId>servicemix-utils</artifactId>
- <packaging>bundle</packaging>
- <version>1.3.0-SNAPSHOT</version>
- <name>Apache ServiceMix :: Utils</name>
- <description>Various utility/helper classes and services for the ServiceMix containers and components</description>
-
- <properties>
- <servicemix.legal.version>1.0</servicemix.legal.version>
- </properties>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/servicemix/utils/trunk</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/servicemix/utils/trunk</developerConnection>
- <url>http://svn.apache.org/viewvc/servicemix/smx4/specs/utils/trunk</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
- <version>2.0.0</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-stax-api_1.0_spec</artifactId>
- <version>1.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>woodstox-core-asl</artifactId>
- <version>4.0.7</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.5.8</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>1.5.8</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.jbi-api-1.0</artifactId>
- <version>1.5.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.locator</artifactId>
- <version>1.5.0</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>2.5.5</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>jaxen</groupId>
- <artifactId>jaxen</artifactId>
- <version>1.1-beta-9</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.3</version>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <!-- xom is an optional dependency of xstream. Its also
- LGPL, so its really not ASF compatible. -->
- <groupId>xom</groupId>
- <artifactId>xom</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>xmlbeans</groupId>
- <artifactId>xmlpublic</artifactId>
- <version>2.1.0</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.4</version>
- <optional>true</optional>
- </dependency>
- <!-- test dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>2.5.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>2.7.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- <version>3.4.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.7.3.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.4.1.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jencks</groupId>
- <artifactId>jencks</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>tranql</groupId>
- <artifactId>tranql-connector</artifactId>
- <version>1.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>
- <version>1.1.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.6</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>${project.name}</Bundle-Name>
- <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>
- org.apache.servicemix*;-noimport:=true
- </Export-Package>
- <Import-Package>
- *;resolution:=optional
- </Import-Package>
- <Private-Package>
- org.apache.servicemix.specs.locator;-split-package:=merge-first
- </Private-Package>
- <Bundle-Activator>
- org.apache.servicemix.specs.locator.Activator
- </Bundle-Activator>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-7</version>
- <configuration>
- <useReleaseProfile>false</useReleaseProfile>
- <preparationGoals>clean verify install</preparationGoals>
- <goals>deploy</goals>
- <arguments>-Prelease,deploy</arguments>
- <autoVersionSubmodules>true</autoVersionSubmodules>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.1</version>
- <executions>
- <execution>
- <id>copy-legal</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.servicemix.legal</groupId>
- <artifactId>legal</artifactId>
- <version>${servicemix.legal.version}</version>
- <type>xml</type>
- <outputDirectory>target/legal/</outputDirectory>
- </artifactItem>
- </artifactItems>
- <stripVersion>true</stripVersion>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.servicemix.legal</groupId>
- <artifactId>legal</artifactId>
- <version>${servicemix.legal.version}</version>
- <type>xml</type>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <artifactId>maven-remote-resources-plugin</artifactId>
+ 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-pom</artifactId>
+ <version>4</version>
+ </parent>
+
+ <artifactId>servicemix-utils</artifactId>
+ <packaging>bundle</packaging>
+ <version>1.3.0-SNAPSHOT</version>
+ <name>Apache ServiceMix :: Utils</name>
+ <description>Various utility/helper classes and services for the ServiceMix containers and components</description>
+
+ <properties>
+ <servicemix.legal.version>1.0</servicemix.legal.version>
+ </properties>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/servicemix/utils/trunk</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/servicemix/utils/trunk</developerConnection>
+ <url>http://svn.apache.org/viewvc/servicemix/smx4/specs/utils/trunk</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.fusesource.commonman</groupId>
+ <artifactId>commons-management</artifactId>
<version>1.0</version>
- <executions>
- <execution>
- <goals>
- <goal>process</goal>
- </goals>
- <configuration>
- <resourceBundles>
- <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
- </resourceBundles>
- <supplementalModels>
- <supplementalModel>target/legal/legal.xml</supplementalModel>
- </supplementalModels>
- <properties>
- <addLicense>true</addLicense>
- <addArtifact>true</addArtifact>
- <projectName>Apache ServiceMix</projectName>
- </properties>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>release</id>
- <build>
- <plugins>
- <!-- We want to deploy the artifact to a staging location for perusal -->
- <plugin>
- <inherited>true</inherited>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <altDeploymentRepository>${deploy.altRepository}</altDeploymentRepository>
- <updateReleaseInfo>true</updateReleaseInfo>
- </configuration>
- </plugin>
- <!-- We want to sign the artifact, the POM, and all attached artifacts -->
- <plugin>
- <artifactId>maven-gpg-plugin</artifactId>
- <version>1.0-alpha-4</version>
- <executions>
- <execution>
- <goals>
- <goal>sign</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>deploy</id>
- <build>
- <defaultGoal>deploy</defaultGoal>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.0.4</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <source>1.5</source>
- </configuration>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ <version>2.0.0</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ <version>4.0.7</version>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>1.5.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jbi-api-1.0</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.locator</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.5.5</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1-beta-9</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.3</version>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <!-- xom is an optional dependency of xstream. Its also
+ LGPL, so its really not ASF compatible. -->
+ <groupId>xom</groupId>
+ <artifactId>xom</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xmlpublic</artifactId>
+ <version>2.1.0</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ <optional>true</optional>
+ </dependency>
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.5.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ <version>3.4.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.7.3.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.4.1.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jencks</groupId>
+ <artifactId>jencks</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>tranql</groupId>
+ <artifactId>tranql-connector</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>
+ <version>1.1.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.6</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.3</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>${project.name}</Bundle-Name>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+ <Export-Package>
+ org.apache.servicemix*;-noimport:=true
+ </Export-Package>
+ <Import-Package>
+ *;resolution:=optional
+ </Import-Package>
+ <Private-Package>
+ org.apache.servicemix.specs.locator;-split-package:=merge-first
+ </Private-Package>
+ <Bundle-Activator>
+ org.apache.servicemix.specs.locator.Activator
+ </Bundle-Activator>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ <configuration>
+ <useReleaseProfile>false</useReleaseProfile>
+ <preparationGoals>clean verify install</preparationGoals>
+ <goals>deploy</goals>
+ <arguments>-Prelease,deploy</arguments>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <id>copy-legal</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.servicemix.legal</groupId>
+ <artifactId>legal</artifactId>
+ <version>${servicemix.legal.version}</version>
+ <type>xml</type>
+ <outputDirectory>target/legal/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ <stripVersion>true</stripVersion>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicemix.legal</groupId>
+ <artifactId>legal</artifactId>
+ <version>${servicemix.legal.version}</version>
+ <type>xml</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
+ </resourceBundles>
+ <supplementalModels>
+ <supplementalModel>target/legal/legal.xml</supplementalModel>
+ </supplementalModels>
+ <properties>
+ <addLicense>true</addLicense>
+ <addArtifact>true</addArtifact>
+ <projectName>Apache ServiceMix</projectName>
+ </properties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <!-- We want to deploy the artifact to a staging location for perusal -->
+ <plugin>
+ <inherited>true</inherited>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <altDeploymentRepository>${deploy.altRepository}</altDeploymentRepository>
+ <updateReleaseInfo>true</updateReleaseInfo>
+ </configuration>
+ </plugin>
+ <!-- We want to sign the artifact, the POM, and all attached artifacts -->
+ <plugin>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.0-alpha-4</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>deploy</id>
+ <build>
+ <defaultGoal>deploy</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.4</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <source>1.5</source>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorFactoryImpl.java
URL: http://svn.apache.org/viewvc/servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorFactoryImpl.java?rev=1021876&r1=1021875&r2=1021876&view=diff
==============================================================================
--- servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorFactoryImpl.java (original)
+++ servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorFactoryImpl.java Tue Oct 12 18:31:16 2010
@@ -34,35 +34,53 @@ import org.apache.servicemix.executors.E
/**
* Default implementation of the ExecutorFactory.
- *
+ * <p/>
* Configuration can be done hierachically.
* When an executor is created with an id of <code>foo.bar</code>,
* the factory will look for a configuration in the following
* way:
* <ul>
- * <li>configs.get("foo.bar")</li>
- * <li>configs.get("foo")</li>
- * <li>defaultConfig</li>
+ * <li>configs.get("foo.bar")</li>
+ * <li>configs.get("foo")</li>
+ * <li>defaultConfig</li>
* </ul>
- *
+ *
* @author <a href="mailto:gnodet [at] gmail.com">Guillaume Nodet</a>
*/
public class ExecutorFactoryImpl implements ExecutorFactory {
+ private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(ExecutorFactoryImpl.class);
+
+ private static final String OBJECT_NAME_PREFIX = "org.apache.servicemix:ContainerName=ServiceMix,Name=Executors,Type=";
+
private ExecutorConfig defaultConfig = new ExecutorConfig();
+ private javax.management.MBeanServer mbeanServer;
+ private org.fusesource.commons.management.ManagementStrategy managementStrategy;
+
private Map<String, ExecutorConfig> configs = new HashMap<String, ExecutorConfig>();
public Executor createExecutor(String id) {
ExecutorConfig config = getConfig(id);
- return new ExecutorImpl(createService(id, config), config.getShutdownDelay(), config.isBypassIfSynchronous());
+ ExecutorImpl executor = new ExecutorImpl(createService(id, config), config.getShutdownDelay(), config.isBypassIfSynchronous());
+ try {
+ registerMBean(id, executor, config);
+ } catch (Exception ex) {
+ LOG.error("Unable to register MBean for the executor with id " + id, ex);
+ }
+ return executor;
}
public Executor createDaemonExecutor(String id) {
-
ExecutorConfig config = getConfig(id);
config.setThreadDaemon(true);
- return new ExecutorImpl(createService(id, config), config.getShutdownDelay(), config.isBypassIfSynchronous());
+ ExecutorImpl executor = new ExecutorImpl(createService(id, config), config.getShutdownDelay(), config.isBypassIfSynchronous());
+ try {
+ registerMBean(id, executor, config);
+ } catch (Exception ex) {
+ LOG.error("Unable to register MBean for the executor with id " + id, ex);
+ }
+ return executor;
}
protected ExecutorConfig getConfig(String id) {
@@ -95,15 +113,15 @@ public class ExecutorFactoryImpl impleme
ThreadFactory factory = new DefaultThreadFactory(id, config.isThreadDaemon(), config.getThreadPriority());
RejectedExecutionHandler handler = (RejectedExecutionHandler) FactoryFinder.find(RejectedExecutionHandler.class.getName(),
- ThreadPoolExecutor.CallerRunsPolicy.class.getName());
+ ThreadPoolExecutor.CallerRunsPolicy.class.getName());
ThreadPoolExecutor service = new ThreadPoolExecutor(config.getCorePoolSize(),
config.getMaximumPoolSize() < 0 ? Integer.MAX_VALUE : config.getMaximumPoolSize(), config
- .getKeepAliveTime(), TimeUnit.MILLISECONDS, queue, factory, handler);
+ .getKeepAliveTime(), TimeUnit.MILLISECONDS, queue, factory, handler);
if (config.isAllowCoreThreadsTimeout()) {
try {
- Method mth = service.getClass().getMethod("allowCoreThreadTimeOut", new Class[] {boolean.class });
- mth.invoke(service, new Object[] {Boolean.TRUE });
+ Method mth = service.getClass().getMethod("allowCoreThreadTimeOut", new Class[]{boolean.class});
+ mth.invoke(service, new Object[]{Boolean.TRUE});
} catch (Throwable t) {
// Do nothing
}
@@ -173,4 +191,48 @@ public class ExecutorFactoryImpl impleme
this.defaultConfig = defaultConfig;
}
+ public javax.management.MBeanServer getMbeanServer() {
+ return mbeanServer;
+ }
+
+ public void setMbeanServer(javax.management.MBeanServer mbeanServer) {
+ this.mbeanServer = mbeanServer;
+ LOG.debug(">>>> SET MBEAN SERVER TO : " + mbeanServer);
+ }
+
+ public org.fusesource.commons.management.ManagementStrategy getManagementStrategy() {
+ return managementStrategy;
+ }
+
+ public void setManagementStrategy(org.fusesource.commons.management.ManagementStrategy managementStrategy) {
+ this.managementStrategy = managementStrategy;
+ LOG.debug(">>>> SET MANAGEMENT STRATEGY TO : " + managementStrategy);
+ }
+
+ private void registerMBean(String id, ExecutorImpl executor, ExecutorConfig config) throws Exception {
+ ManagedExecutor mbean = new org.apache.servicemix.executors.impl.ManagedExecutor(id, executor, config);
+
+ if (this.managementStrategy != null) {
+ // SMX 4 - ManagementStrategy
+ this.managementStrategy.manageNamedObject(mbean, new javax.management.ObjectName(String.format("%s%s", OBJECT_NAME_PREFIX, sanitize(id))));
+ } else if (this.mbeanServer != null) {
+ // SMX 3 - MBeanServer
+ this.mbeanServer.registerMBean(mbean, new javax.management.ObjectName(String.format("%s%s", OBJECT_NAME_PREFIX, sanitize(id))));
+ } else {
+ // no possibility to insert the mbean
+ }
+ }
+
+ private String sanitize(String in) {
+ String result = null;
+ if (in != null) {
+ result = in.replace(':', '_');
+ result = result.replace('/', '_');
+ result = result.replace('\\', '_');
+ result = result.replace('?', '_');
+ result = result.replace('=', '_');
+ result = result.replace(',', '_');
+ }
+ return result;
+ }
}
Modified: servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorImpl.java
URL: http://svn.apache.org/viewvc/servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorImpl.java?rev=1021876&r1=1021875&r2=1021876&view=diff
==============================================================================
--- servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorImpl.java (original)
+++ servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ExecutorImpl.java Tue Oct 12 18:31:16 2010
@@ -24,9 +24,9 @@ import org.apache.servicemix.executors.E
import org.apache.servicemix.executors.ExecutorAwareRunnable;
/**
- * The default Executor implementation which uses a
+ * The default Executor implementation which uses a
* ThreadPoolExecutor underneath.
- *
+ *
* @author <a href="mailto:gnodet [at] gmail.com">Guillaume Nodet</a>
*/
public class ExecutorImpl implements Executor {
@@ -80,4 +80,7 @@ public class ExecutorImpl implements Exe
return queue.size();
}
+ ThreadPoolExecutor getThreadPoolExecutor() {
+ return this.threadPool;
+ }
}
Added: servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutor.java
URL: http://svn.apache.org/viewvc/servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutor.java?rev=1021876&view=auto
==============================================================================
--- servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutor.java (added)
+++ servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutor.java Tue Oct 12 18:31:16 2010
@@ -0,0 +1,188 @@
+/*
+ * 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.servicemix.executors.impl;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.servicemix.executors.Executor;
+
+public class ManagedExecutor extends javax.management.StandardMBean implements Executor, ManagedExecutorMBean {
+
+ private String id;
+ private ExecutorImpl internalExecutor;
+ private ExecutorConfig config;
+ private AtomicLong rejectedExecutions;
+
+
+ public ManagedExecutor(String id, ExecutorImpl internalExecutor, ExecutorConfig config) throws javax.management.NotCompliantMBeanException {
+ super(ManagedExecutorMBean.class);
+ this.id = id;
+ this.internalExecutor = internalExecutor;
+ this.config = config;
+ this.rejectedExecutions = new AtomicLong(0L);
+ if (this.internalExecutor != null) {
+ setupWrapper();
+ }
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public int getActiveCount() {
+ return this.internalExecutor != null ? this.internalExecutor.getThreadPoolExecutor().getActiveCount() : 0;
+ }
+
+ public long getCompletedTaskCount() {
+ return this.internalExecutor != null ? this.internalExecutor.getThreadPoolExecutor().getCompletedTaskCount() : 0;
+ }
+
+ public int getCorePoolSize() {
+ return this.internalExecutor != null ? this.internalExecutor.getThreadPoolExecutor().getCorePoolSize() : 0;
+ }
+
+ public void setCorePoolSize(int size) {
+ if (this.internalExecutor != null) {
+ this.internalExecutor.getThreadPoolExecutor().setCorePoolSize(size);
+ }
+ }
+
+ public long getKeepAliveTimeInMillis() {
+ return this.internalExecutor != null ? this.internalExecutor.getThreadPoolExecutor().getKeepAliveTime(TimeUnit.MILLISECONDS) : 0L;
+ }
+
+ public void setKeepAliveTimeInMillis(long timeInMillis) {
+ if (this.internalExecutor != null) {
+ this.internalExecutor.getThreadPoolExecutor().setKeepAliveTime(timeInMillis, TimeUnit.MILLISECONDS);
+ }
+ }
+
+ public int getLargestPoolSize() {
+ return this.internalExecutor != null ? this.internalExecutor.getThreadPoolExecutor().getLargestPoolSize() : 0;
+ }
+
+ public int getMaximumPoolSize() {
+ return this.internalExecutor != null ? this.internalExecutor.getThreadPoolExecutor().getMaximumPoolSize() : 0;
+ }
+
+ public void setMaximumPoolSize(int size) {
+ if (this.internalExecutor != null) {
+ this.internalExecutor.getThreadPoolExecutor().setMaximumPoolSize(size);
+ }
+ }
+
+ public int getPoolSize() {
+ return this.internalExecutor != null ? this.internalExecutor.getThreadPoolExecutor().getPoolSize() : 0;
+ }
+
+ public long getTaskCount() {
+ return this.internalExecutor != null ? this.internalExecutor.getThreadPoolExecutor().getTaskCount() : 0;
+ }
+
+ public int getQueueSize() {
+ return this.internalExecutor != null ? this.internalExecutor.size() : 0;
+ }
+
+ public boolean isAllowCoreThreadTimeout() {
+ return this.internalExecutor != null && this.internalExecutor.getThreadPoolExecutor().allowsCoreThreadTimeOut();
+ }
+
+ public long getNumberOfRejectedExecutions() {
+ return this.rejectedExecutions.get();
+ }
+
+ public void reset() {
+ this.rejectedExecutions.set(0L);
+ }
+
+ public long getShutdownDelay() {
+ return this.config != null ? this.config.getShutdownDelay() : 0L;
+ }
+
+ public boolean isBypassIfSynchronous() {
+ return this.config != null && this.config.isBypassIfSynchronous();
+ }
+
+ public void increaseRejectedExecutions() {
+ this.rejectedExecutions.incrementAndGet();
+ }
+
+ private void setupWrapper() {
+ this.internalExecutor.getThreadPoolExecutor().setRejectedExecutionHandler(new WrappedRejectedExecutionHandler(this));
+ }
+
+ public ExecutorImpl getInternalExecutor() {
+ return this.internalExecutor;
+ }
+
+ public void execute(Runnable command) {
+ if (this.internalExecutor != null) {
+ this.internalExecutor.execute(command);
+ }
+ }
+
+ public void shutdown() {
+ if (this.internalExecutor != null) {
+ this.internalExecutor.shutdown();
+ }
+ }
+
+ public int capacity() {
+ return this.internalExecutor != null ? this.internalExecutor.capacity() : 0;
+ }
+
+ public int size() {
+ return this.internalExecutor != null ? this.internalExecutor.size() : 0;
+ }
+
+ @Override
+ protected String getDescription(javax.management.MBeanInfo info) {
+ return "Managed Executor";
+ }
+
+ @Override
+ protected String getDescription(javax.management.MBeanFeatureInfo info) {
+ if ("name".equalsIgnoreCase(info.getName())) {
+ return "Name of the endpoint";
+ }
+ if ("properties".equalsIgnoreCase(info.getName())) {
+ return "Properties associated to this endpoint";
+ }
+ if ("inboundExchangeCount".equalsIgnoreCase(info.getName())) {
+ return "Number of exchanges received";
+ }
+ if ("inboundExchangeCount".equalsIgnoreCase(info.getName())) {
+ return "Number of exchanges received";
+ }
+ if ("inboundExchangeRate".equalsIgnoreCase(info.getName())) {
+ return "Exchanges received per second";
+ }
+ if ("outboundExchangeCount".equalsIgnoreCase(info.getName())) {
+ return "Number of exchanges sent";
+ }
+ if ("outboundExchangeRate".equalsIgnoreCase(info.getName())) {
+ return "Exchanges sent per second";
+ }
+ if ("reset".equalsIgnoreCase(info.getName())) {
+ return "Reset statistics";
+ }
+ return null;
+ }
+}
Added: servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutorMBean.java
URL: http://svn.apache.org/viewvc/servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutorMBean.java?rev=1021876&view=auto
==============================================================================
--- servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutorMBean.java (added)
+++ servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/ManagedExecutorMBean.java Tue Oct 12 18:31:16 2010
@@ -0,0 +1,56 @@
+/*
+ * 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.servicemix.executors.impl;
+
+public interface ManagedExecutorMBean {
+
+ int getActiveCount();
+
+ long getCompletedTaskCount();
+
+ int getCorePoolSize();
+
+ void setCorePoolSize(int size);
+
+ long getKeepAliveTimeInMillis();
+
+ void setKeepAliveTimeInMillis(long timeInMillis);
+
+ int getLargestPoolSize();
+
+ int getMaximumPoolSize();
+
+ void setMaximumPoolSize(int size);
+
+ int getPoolSize();
+
+ long getTaskCount();
+
+ int getQueueSize();
+
+ boolean isAllowCoreThreadTimeout();
+
+ long getNumberOfRejectedExecutions();
+
+ void reset();
+
+ long getShutdownDelay();
+
+ boolean isBypassIfSynchronous();
+}
Added: servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/WrappedRejectedExecutionHandler.java
URL: http://svn.apache.org/viewvc/servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/WrappedRejectedExecutionHandler.java?rev=1021876&view=auto
==============================================================================
--- servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/WrappedRejectedExecutionHandler.java (added)
+++ servicemix/utils/trunk/src/main/java/org/apache/servicemix/executors/impl/WrappedRejectedExecutionHandler.java Tue Oct 12 18:31:16 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.servicemix.executors.impl;
+
+import java.util.concurrent.RejectedExecutionHandler;
+import java.util.concurrent.ThreadPoolExecutor;
+
+public class WrappedRejectedExecutionHandler implements RejectedExecutionHandler {
+
+ private RejectedExecutionHandler wrappedHandler;
+ private ManagedExecutor executor;
+
+ public WrappedRejectedExecutionHandler(ManagedExecutor executor) {
+ this.executor = executor;
+ this.wrappedHandler = this.executor.getInternalExecutor().getThreadPoolExecutor().getRejectedExecutionHandler();
+ }
+
+ public void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadPoolExecutor) {
+ this.executor.increaseRejectedExecutions();
+ this.wrappedHandler.rejectedExecution(runnable, threadPoolExecutor);
+ }
+}