activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-273 Use data locations not dir in moveData
Date Wed, 21 Oct 2015 13:49:37 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master e1be56d7e -> b89e3f53b


ARTEMIS-273 Use data locations not dir in moveData


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/6aae2cc5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/6aae2cc5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/6aae2cc5

Branch: refs/heads/master
Commit: 6aae2cc5f1a776b1e2645d26d1b6e3c1adf4473f
Parents: e1be56d
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Tue Oct 20 15:43:03 2015 +0100
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Wed Oct 21 11:54:41 2015 +0100

----------------------------------------------------------------------
 .../core/server/impl/ActiveMQServerImpl.java       | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6aae2cc5/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 07f88bc..7ac3036 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -1881,15 +1881,18 @@ public class ActiveMQServerImpl implements ActiveMQServer {
     * move any older data away and log a warning about it.
     */
    void moveServerData() {
-      String[] dataDirs = new String[]{configuration.getBindingsDirectory(), configuration.getJournalDirectory(),
configuration.getPagingDirectory(), configuration.getLargeMessagesDirectory()};
+      File[] dataDirs = new File[]{configuration.getBindingsLocation(),
+                                   configuration.getJournalLocation(),
+                                   configuration.getPagingLocation(),
+                                   configuration.getLargeMessagesLocation()};
+
       boolean allEmpty = true;
       int lowestSuffixForMovedData = 1;
       boolean redo = true;
 
       while (redo) {
          redo = false;
-         for (String dir : dataDirs) {
-            File fDir = new File(dir);
+         for (File fDir : dataDirs) {
             if (fDir.exists()) {
                if (!fDir.isDirectory()) {
                   throw ActiveMQMessageBundle.BUNDLE.journalDirIsFile(fDir);
@@ -1909,24 +1912,22 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       if (allEmpty)
          return;
 
-      for (String dir0 : dataDirs) {
-         File dir = new File(dir0);
+      for (File dir : dataDirs) {
          File newPath = new File(dir.getPath() + lowestSuffixForMovedData);
          if (dir.exists()) {
             if (!dir.renameTo(newPath)) {
                throw ActiveMQMessageBundle.BUNDLE.couldNotMoveJournal(dir);
             }
 
-            ActiveMQServerLogger.LOGGER.backupMovingDataAway(dir0, newPath.getPath());
+            ActiveMQServerLogger.LOGGER.backupMovingDataAway(dir.getAbsolutePath(), newPath.getPath());
          }
          /*
          * sometimes OS's can hold on to file handles for a while so we need to check this
actually qorks and then wait
          * a while and try again if it doesn't
          * */
 
-         File dirToRecreate = new File(dir0);
          int count = 0;
-         while (!dirToRecreate.exists() && !dirToRecreate.mkdir()) {
+         while (!dir.exists() && !dir.mkdir()) {
             try {
                Thread.sleep(1000);
             }


Mime
View raw message