You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dw...@apache.org on 2008/02/17 20:37:13 UTC
svn commit: r628537 [2/2] - in
/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3: ./
geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/
geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/...
Modified: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java?rev=628537&r1=628536&r2=628537&view=diff
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java (original)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java Sun Feb 17 11:37:08 2008
@@ -73,8 +73,8 @@
protected MockManagedConnectionFactory mockManagedConnectionFactory;
protected ConnectorInstanceContextImpl connectorInstanceContext;
protected DefaultComponentInterceptor defaultComponentInterceptor;
- protected Set unshareableResources = new HashSet();
- protected Set applicationManagedSecurityResources = new HashSet();
+ protected Set<String> unshareableResources = new HashSet<String>();
+ protected Set<String> applicationManagedSecurityResources = new HashSet<String>();
protected MockManagedConnection mockManagedConnection;
protected Subject subject;
protected UserTransaction userTransaction;
@@ -93,6 +93,7 @@
private ClassLoader classLoader = this.getClass().getClassLoader();
protected void setUp() throws Exception {
+ super.setUp();
TransactionManagerImpl transactionManager = new TransactionManagerImpl();
this.transactionManager = transactionManager;
@@ -126,6 +127,7 @@
connectionManagerDeployment = null;
connectionFactory = null;
connectorInstanceContext = null;
+ super.tearDown();
}
public Object invoke(ConnectorInstanceContext newConnectorInstanceContext) throws Throwable {
Added: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllTest.java?rev=628537&view=auto
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllTest.java (added)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllTest.java Sun Feb 17 11:37:08 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.connector.outbound;
+
+/**
+ * @version $Rev: 620213 $ $Date: 2008-02-09 18:13:09 -0500 (Sat, 09 Feb 2008) $
+ */
+public class SinglePoolMatchAllTest extends AbstractSinglePoolTest{
+
+ protected void setUp() throws Exception {
+ super.setUp();
+// interceptor = new SinglePoolConnectionInterceptor(switchableInterceptor, maxSize, 0, 100, 1, true);
+ this.interceptor = new SinglePoolMatchAllConnectionInterceptor(switchableInterceptor, maxSize, 0, 100, 1);
+ }
+
+}
\ No newline at end of file
Propchange: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolTest.java?rev=628537&view=auto
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolTest.java (added)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolTest.java Sun Feb 17 11:37:08 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.connector.outbound;
+
+/**
+ * @version $Rev: 620213 $ $Date: 2008-02-09 18:13:09 -0500 (Sat, 09 Feb 2008) $
+ */
+public class SinglePoolTest extends AbstractSinglePoolTest{
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ interceptor = new SinglePoolConnectionInterceptor(switchableInterceptor, maxSize, 0, 100, 1, true);
+// this.interceptor = new SinglePoolMatchAllConnectionInterceptor(switchableInterceptor, maxSize, 0, 100, 1);
+ }
+
+}
Propchange: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/SinglePoolTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java?rev=628537&r1=628536&r2=628537&view=diff
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java (original)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java Sun Feb 17 11:37:08 2008
@@ -46,8 +46,8 @@
private ConnectionTrackingCoordinator connectionTrackingCoordinator;
private ConnectionTrackingInterceptor key1;
private Subject subject = null;
- private Set unshareableResources;
- private Set applicationManagedSecurityResources;
+ private Set<String> unshareableResources;
+ private Set<String> applicationManagedSecurityResources;
private ManagedConnectionInfo mci;
private ConnectionImpl connection;
@@ -55,8 +55,8 @@
super.setUp();
connectionTrackingCoordinator = new ConnectionTrackingCoordinator(true);
key1 = new ConnectionTrackingInterceptor(this, name1, connectionTrackingCoordinator);
- unshareableResources = new HashSet();
- applicationManagedSecurityResources = new HashSet();
+ unshareableResources = new HashSet<String>();
+ applicationManagedSecurityResources = new HashSet<String>();
mci = new ManagedConnectionInfo(null, null);
mci.setManagedConnection(new MockManagedConnection());
@@ -81,8 +81,8 @@
connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);
// connection should be in component instance context
- Map connectionManagerMap = componentContext.getConnectionManagerMap();
- Set infos = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos);
assertEquals("Expected one connection for key1", 1, infos.size());
assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());
@@ -108,7 +108,7 @@
// connection should not be in context
connectionManagerMap = componentContext.getConnectionManagerMap();
- infos = (Set) connectionManagerMap.get(key1);
+ infos = connectionManagerMap.get(key1);
assertEquals("Expected no connection set for key1", null, infos);
// enter again, and close the handle
@@ -135,8 +135,8 @@
connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);
// connection should be in component instance context
- Map connectionManagerMap = componentContext.getConnectionManagerMap();
- Set infos = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos);
assertEquals("Expected one connection for key1", 1, infos.size());
assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());
@@ -180,7 +180,7 @@
// connection should not be in context
connectionManagerMap = componentContext.getConnectionManagerMap();
- infos = (Set) connectionManagerMap.get(key1);
+ infos = connectionManagerMap.get(key1);
assertNull("Expected no connection set for key1", infos);
// use connection which will cause it to get a new handle if it is not closed
@@ -203,8 +203,8 @@
connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);
// connection should be in component instance context
- Map connectionManagerMap = componentContext.getConnectionManagerMap();
- Set infos = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos);
assertEquals("Expected one connection for key1", 1, infos.size());
assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());
@@ -246,7 +246,7 @@
// connection should not be in context
connectionManagerMap = componentContext.getConnectionManagerMap();
- infos = (Set) connectionManagerMap.get(key1);
+ infos = connectionManagerMap.get(key1);
assertNull("Expected no connection set for key1", infos);
// enter again
Modified: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java?rev=628537&r1=628536&r2=628537&view=diff
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java (original)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java Sun Feb 17 11:37:08 2008
@@ -44,16 +44,16 @@
private ConnectionTrackingInterceptor key1;
private ConnectionTrackingInterceptor nestedKey;
private Subject subject = null;
- private Set unshareableResources;
- private Set applicationManagedSecurityResources;
+ private Set<String> unshareableResources;
+ private Set<String> applicationManagedSecurityResources;
protected void setUp() throws Exception {
super.setUp();
connectionTrackingCoordinator = new ConnectionTrackingCoordinator(false);
key1 = new ConnectionTrackingInterceptor(this, name1, connectionTrackingCoordinator);
nestedKey = new ConnectionTrackingInterceptor(this, name2, connectionTrackingCoordinator);
- unshareableResources = new HashSet();
- applicationManagedSecurityResources = new HashSet();
+ unshareableResources = new HashSet<String>();
+ applicationManagedSecurityResources = new HashSet<String>();
}
protected void tearDown() throws Exception {
@@ -77,8 +77,8 @@
connectionTrackingCoordinator.exit(oldConnectorInstanceContext);
// connection should be in component instance context
- Map connectionManagerMap = componentContext.getConnectionManagerMap();
- Set infos = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos);
assertEquals("Expected one connection for key1", 1, infos.size());
assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());
@@ -91,7 +91,7 @@
// connection should not be in context
connectionManagerMap = componentContext.getConnectionManagerMap();
- infos = (Set) connectionManagerMap.get(key1);
+ infos = connectionManagerMap.get(key1);
assertEquals("Expected no connection set for key1", null, infos);
}
@@ -125,8 +125,8 @@
// exit nested component context
connectionTrackingCoordinator.exit(oldConnectorInstanceContext2);
- Map nestedConnectionManagerMap = nextedComponentContext.getConnectionManagerMap();
- Set nestedInfos = (Set) nestedConnectionManagerMap.get(nestedKey);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> nestedConnectionManagerMap = nextedComponentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> nestedInfos = nestedConnectionManagerMap.get(nestedKey);
assertNotNull("Expected one connections for key2", nestedInfos);
assertEquals("Expected one connection for key2", 1, nestedInfos.size());
assertSame("Expected to get supplied ConnectionInfo from infos", nestedConnectionInfo, nestedInfos.iterator().next());
@@ -135,8 +135,8 @@
// exit outer component context
connectionTrackingCoordinator.exit(oldConnectorInstanceContext1);
- Map connectionManagerMap = componentContext1.getConnectionManagerMap();
- Set infos1 = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext1.getConnectionManagerMap();
+ Set<ConnectionInfo> infos1 = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos1);
assertEquals("Expected one connection for key1", 1, infos1.size());
assertSame("Expected to get supplied ConnectionInfo from infos", connectionInfo1, infos1.iterator().next());
@@ -150,7 +150,7 @@
// connection should not be in context
connectionManagerMap = componentContext1.getConnectionManagerMap();
- infos1 = (Set) connectionManagerMap.get(key1);
+ infos1 = connectionManagerMap.get(key1);
assertNull("Expected no connection set for key1", infos1);
}
Modified: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java?rev=628537&r1=628536&r2=628537&view=diff
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java (original)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java Sun Feb 17 11:37:08 2008
@@ -29,6 +29,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.transaction.log.UnrecoverableLog;
@@ -53,6 +54,10 @@
final Recovery recovery;
private final CopyOnWriteArrayList transactionAssociationListeners = new CopyOnWriteArrayList();
private List recoveryErrors = new ArrayList();
+ // statistics
+ private AtomicLong totalCommits = new AtomicLong(0);
+ private AtomicLong totalRollBacks = new AtomicLong(0);
+ private AtomicLong activeCount = new AtomicLong(0);
public TransactionManagerImpl() throws XAException {
this(DEFAULT_TIMEOUT,
@@ -79,7 +84,6 @@
if (defaultTransactionTimeoutSeconds <= 0) {
throw new IllegalArgumentException("defaultTransactionTimeoutSeconds must be positive: attempted value: " + defaultTransactionTimeoutSeconds);
}
-
this.defaultTransactionTimeoutMilliseconds = defaultTransactionTimeoutSeconds * 1000;
if (transactionLog == null) {
@@ -111,6 +115,7 @@
}
threadTx.set(tx);
fireThreadAssociated(tx);
+ activeCount.getAndIncrement();
}
private void unassociate() {
@@ -119,6 +124,7 @@
associatedTransactions.remove(tx);
threadTx.set(null);
fireThreadUnassociated(tx);
+ activeCount.getAndDecrement();
}
}
@@ -240,6 +246,7 @@
} finally {
unassociate();
}
+ totalCommits.getAndIncrement();
}
public void rollback() throws IllegalStateException, SecurityException, SystemException {
@@ -252,6 +259,7 @@
} finally {
unassociate();
}
+ totalRollBacks.getAndIncrement();
}
//XidImporter implementation
@@ -285,6 +293,7 @@
throw (XAException) new XAException().initCause(e);
}
}
+ totalCommits.getAndIncrement();
}
public void forget(Transaction tx) throws XAException {
@@ -309,6 +318,7 @@
} catch (SystemException e) {
throw (XAException) new XAException().initCause(e);
}
+ totalRollBacks.getAndIncrement();
}
long getTransactionTimeoutMilliseconds(long transactionTimeoutMilliseconds) {
@@ -368,5 +378,34 @@
log.warn("Error calling transaction association listener", e);
}
}
+ }
+
+ /**
+ * Returns the number of active transactions.
+ */
+ public long getActiveCount() {
+ return activeCount.longValue();
+ }
+
+ /**
+ * Return the number of total commits
+ */
+ public long getTotalCommits() {
+ return totalCommits.longValue();
+ }
+
+ /**
+ * Returns the number of total rollbacks
+ */
+ public long getTotalRollbacks() {
+ return totalRollBacks.longValue();
+ }
+
+ /**
+ * Reset statistics
+ */
+ public void resetStatistics() {
+ totalCommits.getAndSet(0);
+ totalRollBacks.getAndSet(0);
}
}
Modified: geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/pom.xml?rev=628537&r1=628536&r2=628537&view=diff
==============================================================================
--- geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/pom.xml (original)
+++ geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.0.3/pom.xml Sun Feb 17 11:37:08 2008
@@ -210,8 +210,61 @@
<linkModules>true</linkModules>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <tagBase>https://svn.apache.org/repos/asf/geronimo/components/txmanager/tags/</tagBase>
+ </configuration>
+ </plugin>
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <!-- We want to sign the artifact, the POM, and all attached artifacts -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <configuration>
+ <passphrase>${gpg.passphrase}</passphrase>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- We want to deploy the artifact to a staging location for perusal -->
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <altDeploymentRepository>${deploy.altRepository}</altDeploymentRepository>
+ <updateReleaseInfo>true</updateReleaseInfo>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>