aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1796992 - in /aries/trunk/transaction/transaction-manager/src: main/java/org/apache/aries/transaction/internal/ main/resources/org/apache/aries/transaction/internal/ test/java/org/apache/aries/transaction/internal/
Date Wed, 31 May 2017 07:55:06 GMT
Author: cschneider
Date: Wed May 31 07:55:06 2017
New Revision: 1796992

URL: http://svn.apache.org/viewvc?rev=1796992&view=rev
Log:
[ARIES-1728] Remove NLS from transaction manager

Removed:
    aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/NLS.java
    aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/transaction/internal/txManager.properties
    aries/trunk/transaction/transaction-manager/src/test/java/org/apache/aries/transaction/internal/NLSTest.java
Modified:
    aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/Activator.java
    aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionLogUtils.java
    aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionManagerService.java

Modified: aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/Activator.java?rev=1796992&r1=1796991&r2=1796992&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/Activator.java
(original)
+++ aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/Activator.java
Wed May 31 07:55:06 2017
@@ -101,7 +101,7 @@ public class Activator implements Bundle
                     TransactionLogUtils.copyActiveTransactions((Dictionary<String, Object>)
this.properties, properties);
                 }
             } catch (IOException e) {
-                log.error(NLS.MESSAGES.getMessage("exception.tx.manager.start"), e);
+                log.error("An exception occurred starting the transaction manager.", e);
             }
 
             this.properties = properties;
@@ -109,7 +109,7 @@ public class Activator implements Bundle
             try {
                 manager.start();
             } catch (Exception e) {
-                log.error(NLS.MESSAGES.getMessage("exception.tx.manager.start"), e);
+                log.error("An exception occurred starting the transaction manager.", e);
             }
         }
     }
@@ -139,7 +139,7 @@ public class Activator implements Bundle
             try {
                 manager.close();
             } catch (Exception e) {
-                log.error(NLS.MESSAGES.getMessage("exception.tx.manager.stop"), e);
+                log.error("An exception occurred stopping the transaction manager.", e);
             } finally {
                 manager = null;
             }

Modified: aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionLogUtils.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionLogUtils.java?rev=1796992&r1=1796991&r2=1796992&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionLogUtils.java
(original)
+++ aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionLogUtils.java
Wed May 31 07:55:06 2017
@@ -107,7 +107,7 @@ public class TransactionLogUtils {
             // old log files compatible, but maybe we have to copy them
             if (!oldDir.equals(newDir)) {
                 if (!oldDir.renameTo(newDir)) {
-                    log.warn(NLS.MESSAGES.getMessage("tx.log.problem.renaming", oldDir.getAbsolutePath()));
+                    log.warn("Can't backup old transaction logs directory: {}", oldDir.getAbsolutePath());
                     return false;
                 }
             }
@@ -149,14 +149,14 @@ public class TransactionLogUtils {
             // move old dir to backup dir
             backupDir = new File(newLogDirectory + String.format("-%016x", System.currentTimeMillis()));
             if (!oldDir.renameTo(backupDir)) {
-                log.warn(NLS.MESSAGES.getMessage("tx.log.problem.renaming", oldDir.getAbsolutePath()));
+                log.warn("Can't backup old transaction logs directory: {}", oldDir.getAbsolutePath());
                 return false;
             }
             oldConfiguration = copy(oldConfiguration);
             oldConfiguration.put(HOWL_LOG_FILE_DIR, backupDir.getAbsolutePath());
         }
 
-        log.info(NLS.MESSAGES.getMessage("tx.log.conversion", oldDir.getAbsolutePath(), newDir.getAbsolutePath()));
+        log.info("Copying transaction log from {} to {}", oldDir.getAbsolutePath(), newDir.getAbsolutePath());
 
         oldConfiguration.put(RECOVERABLE, newConfiguration.get(RECOVERABLE));
         oldConfiguration.put(HOWL_MAX_LOG_FILES, Integer.toString(oldTxConfig.maxLogFiles));
@@ -175,11 +175,11 @@ public class TransactionLogUtils {
             newLog = TransactionManagerService.createTransactionLog(newConfiguration, xidFactory2);
 
             if (!(oldLog instanceof HOWLLog)) {
-                log.info(NLS.MESSAGES.getMessage("tx.log.notrecoverable", oldLogDirectory));
+                log.info("TransactionLog {} is not recoverable", oldLogDirectory);
                 return false;
             }
             if (!(newLog instanceof HOWLLog)) {
-                log.info(NLS.MESSAGES.getMessage("tx.log.notrecoverable", newLogDirectory));
+                log.info("TransactionLog {} is not recoverable", newLogDirectory);
                 return false;
             }
 
@@ -188,18 +188,18 @@ public class TransactionLogUtils {
 
             Collection<Recovery.XidBranchesPair> pairs = from.recover(xidFactory1);
             for (Recovery.XidBranchesPair xidBranchesPair : pairs) {
-                log.info(NLS.MESSAGES.getMessage("tx.log.migrate.xid", xidBranchesPair.getXid()));
+                log.info("Copying active transaction with XID {}", xidBranchesPair.getXid());
                 for (TransactionBranchInfo branchInfo : xidBranchesPair.getBranches()) {
-                    log.info(NLS.MESSAGES.getMessage("tx.log.migrate.xid.branch", branchInfo.getBranchXid(),
branchInfo.getResourceName()));
+                    log.info("- Copying branch {} for resource {}", branchInfo.getBranchXid(),
branchInfo.getResourceName());
                 }
                 to.prepare(xidBranchesPair.getXid(), new ArrayList<TransactionBranchInfo>(xidBranchesPair.getBranches()));
             }
-            log.info(NLS.MESSAGES.getMessage("tx.log.migrate.complete"));
+            log.info("Migration of active transactions finished");
             deleteDirectory(backupDir);
 
             return !pairs.isEmpty();
         } catch (Exception e) {
-            log.error(NLS.MESSAGES.getMessage("exception.tx.log.migration"), e);
+            log.error("An exception occurred while trying to migrate transaction log after
changing configuration.", e);
             if (backupDir != null) {
                 deleteDirectory(newDir);
                 backupDir.renameTo(oldDir);

Modified: aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionManagerService.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionManagerService.java?rev=1796992&r1=1796991&r2=1796992&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionManagerService.java
(original)
+++ aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/internal/TransactionManagerService.java
Wed May 31 07:55:06 2017
@@ -80,7 +80,7 @@ public class TransactionManagerService {
         // Transaction timeout
         int transactionTimeout = getInt(this.properties, TRANSACTION_TIMEOUT, DEFAULT_TRANSACTION_TIMEOUT);
         if (transactionTimeout <= 0) {
-            throw new ConfigurationException(TRANSACTION_TIMEOUT, NLS.MESSAGES.getMessage("tx.timeout.greaterthan.zero"));
+            throw new ConfigurationException(TRANSACTION_TIMEOUT, "The transaction timeout
property must be greater than zero.");
         }
 
         final String tmid = getString(this.properties, TMID, pid);
@@ -97,7 +97,7 @@ public class TransactionManagerService {
                 transactionManager = new AriesTransactionManagerImpl(transactionTimeout,
xidFactory, transactionLog);
             }
         } catch (XAException e) {
-            throw new RuntimeException(NLS.MESSAGES.getMessage("tx.recovery.error"), e);
+            throw new RuntimeException("An exception occurred during transaction recovery.",
e);
         }
     }
 
@@ -143,7 +143,7 @@ public class TransactionManagerService {
             try {
                 return Integer.parseInt(value);
             } catch (Exception e) {
-                throw new ConfigurationException(property, NLS.MESSAGES.getMessage("prop.value.not.int",
property, value), e);
+                throw new ConfigurationException(property, "The property " + property + "
should have an integer value, but the value " + value + " is not an integer.", e);
             }
         }
         return dflt;
@@ -155,7 +155,7 @@ public class TransactionManagerService {
             try {
                 return Boolean.parseBoolean(value);
             } catch (Exception e) {
-                throw new ConfigurationException(property, NLS.MESSAGES.getMessage("prop.value.not.boolean",
property, value), e);
+                throw new ConfigurationException(property, "The property " + property + "
should have a boolean value, but the value " + value + " is not a boolean.", e);
             }
         }
         return dflt;
@@ -167,7 +167,7 @@ public class TransactionManagerService {
             String bufferClassName = getString(properties, HOWL_BUFFER_CLASS_NAME, "org.objectweb.howl.log.BlockLogBuffer");
             int bufferSizeKBytes = getInt(properties, HOWL_BUFFER_SIZE, 4);
             if (bufferSizeKBytes < 1 || bufferSizeKBytes > 32) {
-                throw new ConfigurationException(HOWL_BUFFER_SIZE, NLS.MESSAGES.getMessage("buffer.size.between.one.and.thirtytwo"));
+                throw new ConfigurationException(HOWL_BUFFER_SIZE, "The buffer size must
be between one and thirty-two.");
             }
             boolean checksumEnabled = getBool(properties, HOWL_CHECKSUM_ENABLED, true);
             boolean adler32Checksum = getBool(properties, HOWL_ADLER32_CHECKSUM, true);
@@ -178,17 +178,17 @@ public class TransactionManagerService {
             int maxLogFiles = getInt(properties, HOWL_MAX_LOG_FILES, 2);
             int minBuffers = getInt(properties, HOWL_MIN_BUFFERS, 4);
             if (minBuffers < 0) {
-                throw new ConfigurationException(HOWL_MIN_BUFFERS, NLS.MESSAGES.getMessage("min.buffers.greaterthan.zero"));
+                throw new ConfigurationException(HOWL_MIN_BUFFERS, "The minimum number of
buffers must be greater than zero.");
             }
             int maxBuffers = getInt(properties, HOWL_MAX_BUFFERS, 0);
             if (maxBuffers > 0 && minBuffers < maxBuffers) {
-                throw new ConfigurationException(HOWL_MAX_BUFFERS, NLS.MESSAGES.getMessage("max.buffers.greaterthan.min.buffers"));
+                throw new ConfigurationException(HOWL_MAX_BUFFERS, "The maximum number of
buffers must be greater than the minimum number of buffers.");
             }
             int threadsWaitingForceThreshold = getInt(properties, HOWL_THREADS_WAITING_FORCE_THRESHOLD,
-1);
             boolean flushPartialBuffers = getBool(properties, HOWL_FLUSH_PARTIAL_BUFFERS,
true);
             String logFileDir = getString(properties, HOWL_LOG_FILE_DIR, null);
             if (logFileDir == null || logFileDir.length() == 0 || !new File(logFileDir).isAbsolute())
{
-                throw new ConfigurationException(HOWL_LOG_FILE_DIR, NLS.MESSAGES.getMessage("log.file.dir"));
+                throw new ConfigurationException(HOWL_LOG_FILE_DIR, "The log file directory
must be set to an absolute directory.");
             }
             try {
                 result = new HOWLLog(bufferClassName,



Mime
View raw message