From d9d1f6297bac9590c93bffd414646e00a0178f37 Mon Sep 17 00:00:00 2001 From: "R.M. Morrien" Date: Thu, 5 Sep 2024 16:17:33 +0200 Subject: [PATCH] Fix checkstyle for issue #24900 merge. --- .../AssocWithThreadResourceHandle.java | 1 + .../LocalTxConnectionEventListener.java | 10 +++--- .../resource/pool/ConnectionPool.java | 2 +- .../resource/pool/PoolManagerImpl.java | 2 +- .../rm/LazyEnlistableResourceManagerImpl.java | 14 ++++----- .../resource/pool/PoolManagerImplTest.java | 31 ++++++++++--------- .../mock/JavaEETransactionManagerMock.java | 4 +++ .../pool/mock/JavaEETransactionMock.java | 3 ++ .../jts/JavaEETransactionManagerTest.java | 21 +++++++------ 9 files changed, 52 insertions(+), 36 deletions(-) diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/AssocWithThreadResourceHandle.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/AssocWithThreadResourceHandle.java index 98d6a99d7b3..c292d3a7858 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/AssocWithThreadResourceHandle.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/AssocWithThreadResourceHandle.java @@ -18,6 +18,7 @@ package com.sun.enterprise.resource; import com.sun.enterprise.resource.allocator.ResourceAllocator; + import jakarta.resource.spi.ManagedConnection; /** diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java index 508cf05c7d8..a68fa6fa729 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java @@ -17,17 +17,19 @@ package com.sun.enterprise.resource.listener; -import java.util.IdentityHashMap; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; import com.sun.enterprise.connectors.ConnectorRuntime; import com.sun.enterprise.resource.ResourceHandle; import com.sun.enterprise.resource.pool.PoolManager; import com.sun.logging.LogDomains; + import jakarta.resource.spi.ConnectionEvent; import jakarta.resource.spi.ManagedConnection; +import java.util.IdentityHashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + /** * @author Binod P.G */ diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/ConnectionPool.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/ConnectionPool.java index 8ca41313a51..4e6ce188fc6 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/ConnectionPool.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/ConnectionPool.java @@ -1099,7 +1099,7 @@ public void resourceClosed(ResourceHandle handle) throws IllegalStateException { if (state.isUnenlisted() || (poolTxHelper.isNonXAResource(handle) && poolTxHelper.isLocalTransactionInProgress() && poolTxHelper.isLocalResourceEligibleForReuse(handle))) { - // Note: the call to isLocalResourceEligibleForReuse can change the enlisted state of the + // Note: the call to isLocalResourceEligibleForReuse can change the enlisted state of the // handle to false if the resource is eligible for reuse. freeUnenlistedResource(handle); } diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolManagerImpl.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolManagerImpl.java index 99321943d88..6b7accd1239 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolManagerImpl.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolManagerImpl.java @@ -370,7 +370,7 @@ public void resourceClosed(ResourceHandle resource) { if (LOG.isLoggable(Level.FINE)) { // Warning resource state logged here might not be valid, could be part of another thread already - // but logging the resource id is useful. + // but logging the resource id is useful. LOG.log(Level.FINE, "PoolManagerImpl.resourceClosed END, resource=" + resource); } } diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/rm/LazyEnlistableResourceManagerImpl.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/rm/LazyEnlistableResourceManagerImpl.java index 77a3ea17a1e..c09e5935d95 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/rm/LazyEnlistableResourceManagerImpl.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/rm/LazyEnlistableResourceManagerImpl.java @@ -17,13 +17,6 @@ package com.sun.enterprise.resource.rm; -import java.util.List; -import java.util.ListIterator; -import java.util.logging.Logger; - -import org.glassfish.api.invocation.ComponentInvocation; -import org.glassfish.resourcebase.resources.api.PoolInfo; - import com.sun.appserv.connectors.internal.api.PoolingException; import com.sun.enterprise.connectors.ConnectorRuntime; import com.sun.enterprise.resource.ResourceHandle; @@ -35,6 +28,13 @@ import jakarta.transaction.SystemException; import jakarta.transaction.Transaction; +import java.util.List; +import java.util.ListIterator; +import java.util.logging.Logger; + +import org.glassfish.api.invocation.ComponentInvocation; +import org.glassfish.resourcebase.resources.api.PoolInfo; + import static com.sun.logging.LogDomains.RSR_LOGGER; import static java.util.logging.Level.WARNING; diff --git a/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/PoolManagerImplTest.java b/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/PoolManagerImplTest.java index 5adbe6da1d1..ad854ad381c 100644 --- a/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/PoolManagerImplTest.java +++ b/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/PoolManagerImplTest.java @@ -16,20 +16,6 @@ package com.sun.enterprise.resource.pool; -import static com.sun.enterprise.resource.pool.ConnectionPoolTest.getPoolInfo; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.createNiceMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.isNull; -import static org.easymock.EasyMock.notNull; -import static org.easymock.EasyMock.replay; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - import com.sun.appserv.connectors.internal.api.ConnectorConstants.PoolType; import com.sun.appserv.connectors.internal.api.ConnectorRuntimeException; import com.sun.appserv.connectors.internal.api.PoolingException; @@ -46,16 +32,19 @@ import com.sun.enterprise.transaction.api.JavaEETransaction; import com.sun.enterprise.transaction.api.JavaEETransactionManager; import com.sun.enterprise.transaction.spi.TransactionalResource; + import jakarta.resource.spi.ManagedConnection; import jakarta.resource.spi.ManagedConnectionFactory; import jakarta.transaction.SystemException; import jakarta.transaction.Transaction; + import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Set; + import org.glassfish.api.admin.ProcessEnvironment; import org.glassfish.api.invocation.InvocationManager; import org.glassfish.api.invocation.InvocationManagerImpl; @@ -66,6 +55,20 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static com.sun.enterprise.resource.pool.ConnectionPoolTest.getPoolInfo; +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.createNiceMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.isNull; +import static org.easymock.EasyMock.notNull; +import static org.easymock.EasyMock.replay; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + public class PoolManagerImplTest { // Mocked instances diff --git a/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/mock/JavaEETransactionManagerMock.java b/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/mock/JavaEETransactionManagerMock.java index af48116e8f4..4cfcc6895b1 100644 --- a/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/mock/JavaEETransactionManagerMock.java +++ b/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/mock/JavaEETransactionManagerMock.java @@ -20,6 +20,7 @@ import com.sun.enterprise.transaction.api.XAResourceWrapper; import com.sun.enterprise.transaction.spi.JavaEETransactionManagerDelegate; import com.sun.enterprise.transaction.spi.TransactionalResource; + import jakarta.resource.spi.XATerminator; import jakarta.resource.spi.work.WorkException; import jakarta.transaction.HeuristicMixedException; @@ -30,11 +31,14 @@ import jakarta.transaction.Synchronization; import jakarta.transaction.SystemException; import jakarta.transaction.Transaction; + import java.rmi.RemoteException; import java.util.ArrayList; import java.util.List; + import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; + import org.glassfish.api.invocation.ComponentInvocation; import org.glassfish.api.invocation.InvocationException; import org.glassfish.api.invocation.ResourceHandler; diff --git a/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/mock/JavaEETransactionMock.java b/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/mock/JavaEETransactionMock.java index 5945c0d1c91..9e05437b280 100644 --- a/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/mock/JavaEETransactionMock.java +++ b/appserver/connectors/connectors-runtime/src/test/java/com/sun/enterprise/resource/pool/mock/JavaEETransactionMock.java @@ -19,13 +19,16 @@ import com.sun.enterprise.transaction.api.JavaEETransaction; import com.sun.enterprise.transaction.api.SimpleResource; import com.sun.enterprise.transaction.spi.TransactionalResource; + import jakarta.persistence.EntityManagerFactory; import jakarta.transaction.HeuristicMixedException; import jakarta.transaction.HeuristicRollbackException; import jakarta.transaction.RollbackException; import jakarta.transaction.Synchronization; import jakarta.transaction.SystemException; + import java.util.Set; + import javax.transaction.xa.XAResource; /** diff --git a/appserver/transaction/jts/src/test/java/com/sun/enterprise/transaction/jts/JavaEETransactionManagerTest.java b/appserver/transaction/jts/src/test/java/com/sun/enterprise/transaction/jts/JavaEETransactionManagerTest.java index 7fd9764118c..6fb9e53067d 100644 --- a/appserver/transaction/jts/src/test/java/com/sun/enterprise/transaction/jts/JavaEETransactionManagerTest.java +++ b/appserver/transaction/jts/src/test/java/com/sun/enterprise/transaction/jts/JavaEETransactionManagerTest.java @@ -28,16 +28,7 @@ import com.sun.enterprise.transaction.TransactionSynchronizationRegistryImpl; import com.sun.enterprise.transaction.UserTransactionImpl; import com.sun.enterprise.transaction.spi.JavaEETransactionManagerDelegate; -import java.beans.PropertyChangeEvent; -import javax.transaction.xa.XAException; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.Xid; -import org.glassfish.api.invocation.InvocationManager; -import org.glassfish.api.naming.SimpleJndiName; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; import jakarta.resource.spi.ManagedConnection; import jakarta.transaction.HeuristicMixedException; import jakarta.transaction.HeuristicRollbackException; @@ -52,6 +43,18 @@ import jakarta.transaction.TransactionSynchronizationRegistry; import jakarta.transaction.UserTransaction; +import java.beans.PropertyChangeEvent; + +import javax.transaction.xa.XAException; +import javax.transaction.xa.XAResource; +import javax.transaction.xa.Xid; + +import org.glassfish.api.invocation.InvocationManager; +import org.glassfish.api.naming.SimpleJndiName; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; import static org.junit.jupiter.api.Assertions.assertEquals;