Improved: Fixing defects reported by FindBugs, package

org.apache.ofbiz.entity.transaction.
(OFBIZ-9707)

Thanks Julian Leichert for reporting and providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812915 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Brohl
2017-10-22 13:27:03 +00:00
parent a886588282
commit 8392d41d95
3 changed files with 6 additions and 6 deletions
@@ -207,7 +207,7 @@ public abstract class GenericXaResource extends Thread implements XAResource {
try {
if (timeout != null) {
// sleep until the transaction times out
sleep(timeout.intValue() * 1000);
sleep(timeout.intValue() * 1000L);
if (active) {
// get the current status
@@ -51,11 +51,11 @@ public class JNDITransactionFactory implements TransactionFactory {
// Debug module name
public static final String module = JNDITransactionFactory.class.getName();
static TransactionManager transactionManager = null;
static UserTransaction userTransaction = null;
volatile TransactionManager transactionManager = null;
volatile UserTransaction userTransaction = null;
// protected static UtilCache dsCache = new UtilCache("entity.JndiDataSources", 0, 0);
protected static ConcurrentHashMap<String, DataSource> dsCache = new ConcurrentHashMap<String, DataSource>();
protected static final ConcurrentHashMap<String, DataSource> dsCache = new ConcurrentHashMap<String, DataSource>();
public TransactionManager getTransactionManager() {
if (transactionManager == null) {
@@ -74,7 +74,7 @@ public final class TransactionUtil implements Status {
private static ThreadLocal<Timestamp> transactionLastNowStamp = new ThreadLocal<Timestamp>();
private static final boolean debugResources = readDebugResources();
public static Map<Xid, DebugXaResource> debugResMap = Collections.<Xid, DebugXaResource>synchronizedMap(new HashMap<Xid, DebugXaResource>());
public static final Map<Xid, DebugXaResource> debugResMap = Collections.<Xid, DebugXaResource>synchronizedMap(new HashMap<Xid, DebugXaResource>());
// in order to improve performance allThreadsTransactionBeginStack and allThreadsTransactionBeginStackSave are only maintained when logging level INFO is on
private static Map<Long, Exception> allThreadsTransactionBeginStack = Collections.<Long, Exception>synchronizedMap(new HashMap<Long, Exception>());
private static Map<Long, List<Exception>> allThreadsTransactionBeginStackSave = Collections.<Long, List<Exception>>synchronizedMap(new HashMap<Long, List<Exception>>());
@@ -854,7 +854,7 @@ public final class TransactionUtil implements Status {
private static ThreadLocal<Map<Transaction, Timestamp>> suspendedTxStartStamps = new ThreadLocal<Map<Transaction, Timestamp>>() {
@Override
public Map<Transaction, Timestamp> initialValue() {
return UtilGenerics.checkMap(new ListOrderedMap());
return UtilGenerics.checkMap(new ListOrderedMap<>());
}
};