[hornetq-commits] JBoss hornetq SVN: r9496 - branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Aug 3 09:36:55 EDT 2010
Author: jmesnil
Date: 2010-08-03 09:36:54 -0400 (Tue, 03 Aug 2010)
New Revision: 9496
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
HA refactoring
* make sure the journal directory exists before trying to create file in it
Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-08-03 03:23:01 UTC (rev 9495)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-08-03 13:36:54 UTC (rev 9496)
@@ -297,22 +297,8 @@
{
try
{
- File journalDir = new File(configuration.getJournalDirectory());
+ checkJournalDirectory();
- if (!journalDir.exists())
- {
- if (configuration.isCreateJournalDir())
- {
- journalDir.mkdirs();
- }
- else
- {
- throw new IllegalArgumentException("Directory " + journalDir +
- " does not exist and will not create it");
- }
- }
-
-
// We now load the node id file, creating it, if it doesn't exist yet
File nodeIDFile = new File(configuration.getJournalDirectory(), "node.id");
@@ -394,21 +380,8 @@
{
log.info("Waiting to obtain live lock");
- File journalDir = new File(configuration.getJournalDirectory());
+ checkJournalDirectory();
- if (!journalDir.exists())
- {
- if (configuration.isCreateJournalDir())
- {
- journalDir.mkdirs();
- }
- else
- {
- throw new IllegalArgumentException("Directory " + journalDir +
- " does not exist and will not create it");
- }
- }
-
liveLock = createLockFile("live.lock", configuration.getJournalDirectory());
liveLock.lock();
@@ -536,6 +509,8 @@
{
try
{
+ checkJournalDirectory();
+
backupLock = createLockFile("backup.lock", configuration.getJournalDirectory());
log.info("Waiting to become backup node");
@@ -1582,11 +1557,14 @@
// We do this at the end - we don't want things like MDBs or other connections connecting to a backup server until
// it is activated
+
+ remotingService.start();
+
+ System.out.println("remoting service is started");
clusterManager.start();
initialised = true;
- remotingService.start();
}
/**
@@ -1893,7 +1871,28 @@
});
}
+
+ /**
+ * Check if journal directory exists or create it (if configured to do so)
+ */
+ private void checkJournalDirectory()
+ {
+ File journalDir = new File(configuration.getJournalDirectory());
+ if (!journalDir.exists())
+ {
+ if (configuration.isCreateJournalDir())
+ {
+ journalDir.mkdirs();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Directory " + journalDir +
+ " does not exist and will not be created");
+ }
+ }
+ }
+
// Inner classes
// --------------------------------------------------------------------------------
}
More information about the hornetq-commits
mailing list