User: dmaplesden
Date: 01/09/03 19:22:29
Modified: src/main/org/jboss/mq/pm/rollinglogged SpyTxLog.java
SpyMessageLog.java PersistenceManager.java
IntegrityLog.java
Log:
Changed initialisation to use "jboss.system.home" as file anchor.
Revision Changes Path
1.3 +5 -5 jbossmq/src/main/org/jboss/mq/pm/rollinglogged/SpyTxLog.java
Index: SpyTxLog.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/pm/rollinglogged/SpyTxLog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SpyTxLog.java 2001/08/17 03:04:05 1.2
+++ SpyTxLog.java 2001/09/04 02:22:29 1.3
@@ -6,7 +6,7 @@
*/
package org.jboss.mq.pm.rollinglogged;
import java.io.IOException;
-
+import java.io.File;
import java.io.Serializable;
import javax.jms.JMSException;
@@ -18,7 +18,7 @@
*
* @created August 16, 2001
* @author: Hiram Chirino ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class SpyTxLog {
@@ -32,12 +32,12 @@
/////////////////////////////////////////////////////////////////////
// Constructors
/////////////////////////////////////////////////////////////////////
- public SpyTxLog( String fileName )
+ public SpyTxLog( File file )
throws JMSException {
try {
- transactionLog = new IntegrityLog( fileName );
+ transactionLog = new IntegrityLog( file );
} catch ( IOException e ) {
- throwJMSException( "Could not open the queue's tranaction log: " +
fileName, e );
+ throwJMSException( "Could not open the queue's tranaction log: " +
file.getAbsolutePath(), e );
}
}
1.3 +5 -4
jbossmq/src/main/org/jboss/mq/pm/rollinglogged/SpyMessageLog.java
Index: SpyMessageLog.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/pm/rollinglogged/SpyMessageLog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SpyMessageLog.java 2001/08/17 03:04:05 1.2
+++ SpyMessageLog.java 2001/09/04 02:22:29 1.3
@@ -8,6 +8,7 @@
import java.io.IOException;
import java.io.Serializable;
+import java.io.File;
import javax.jms.JMSException;
import org.jboss.mq.SpyJMSException;
@@ -20,7 +21,7 @@
*
* @created August 16, 2001
* @author: Hiram Chirino ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class SpyMessageLog {
@@ -32,12 +33,12 @@
/////////////////////////////////////////////////////////////////////
// Constructor
/////////////////////////////////////////////////////////////////////
- public SpyMessageLog( String fileName )
+ public SpyMessageLog( File file )
throws JMSException {
try {
- transactionLog = new IntegrityLog( fileName );
+ transactionLog = new IntegrityLog( file );
} catch ( IOException e ) {
- throwJMSException( "Could not open the queue's tranaction log: " +
fileName, e );
+ throwJMSException( "Could not open the queue's tranaction log: " +
file.getAbsolutePath(), e );
}
}
1.6 +18 -19
jbossmq/src/main/org/jboss/mq/pm/rollinglogged/PersistenceManager.java
Index: PersistenceManager.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/pm/rollinglogged/PersistenceManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PersistenceManager.java 2001/09/01 03:01:00 1.5
+++ PersistenceManager.java 2001/09/04 02:22:29 1.6
@@ -6,6 +6,7 @@
*/
package org.jboss.mq.pm.rollinglogged;
+import java.io.File;
import java.net.URL;
import java.util.HashMap;
import java.util.HashSet;
@@ -13,7 +14,7 @@
import java.util.LinkedList;
import java.util.TreeSet;
import javax.jms.JMSException;
-import javax.management.*;
+import javax.management.ObjectName;
import javax.naming.InitialContext;
import org.jboss.mq.ConnectionToken;
@@ -31,7 +32,7 @@
* This class manages all persistence related services.
*
* @author David Maplesden ([EMAIL PROTECTED])
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class PersistenceManager extends ServiceMBeanSupport implements
org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean
{
@@ -57,10 +58,8 @@
// Maps transactionIds to txInfos
HashMap transToTxLogs = new HashMap();
-
-
// The directory where persistence data should be stored
- URL dataDirURL;
+ File dataDirFile;
TxManager txManager;
private String dataDirectory;
@@ -148,11 +147,11 @@
{
try
{
- SpyMessageLog log = new SpyMessageLog(new URL(dataDirURL,
dest.toString() + ".dat1").getFile());
+ SpyMessageLog log = new SpyMessageLog(new File(dataDirFile,
dest.toString() + ".dat" + numRollOvers));
logInfo = new LogInfo(log, dest, currentTxLog);
logs.put("" + dest, logInfo);
}
- catch (java.net.MalformedURLException e)
+ catch (Exception e)
{
JMSException jme = new SpyJMSException("Error rolling over logs
to new files.");
jme.setLinkedException(e);
@@ -247,8 +246,8 @@
System.out.println("Using new rolling logged persistence manager.");
}
- URL configFile = getClass().getClassLoader().getResource("jboss.jcml");
- dataDirURL = new URL(configFile, dataDirectory);
+ File jbossHome = new File(System.getProperty("jboss.system.home"));
+ dataDirFile = new File(jbossHome, dataDirectory);
//Get an InitialContext
JMSServer server = (JMSServer)getServer().invoke(new
ObjectName(org.jboss.mq.server.JBossMQServiceMBean.OBJECT_NAME), "getJMSServer", new
Object[]{
@@ -433,7 +432,7 @@
TreeSet commitedTxs = new TreeSet();
HashMap txLogs = new HashMap();
- java.io.File dir = new java.io.File(dataDirURL.getFile());
+ java.io.File dir = dataDirFile;
java.io.File[] dataFiles = dir.listFiles();
for (int i = 0; i < dataFiles.length; ++i)
@@ -449,7 +448,7 @@
String sRollOver = name.substring(index + 4);
int rollOver = Integer.parseInt(sRollOver);
numRollOvers = Math.max(numRollOvers, rollOver + 1);
- SpyTxLog txLog = new SpyTxLog(dataFiles[i].getAbsolutePath());
+ SpyTxLog txLog = new SpyTxLog(dataFiles[i]);
txLog.restore(commitedTxs);
txLogs.put(new Integer(rollOver), txLog);
messageLogs.put(txLog, new HashMap());
@@ -474,7 +473,7 @@
String sRollOver = name.substring(index + 4);
int rollOver = Integer.parseInt(sRollOver);
String key = name.substring(0, name.length() - (sRollOver.length() +
4));
- SpyMessageLog messageLog = new
SpyMessageLog(dataFiles[i].getAbsolutePath());
+ SpyMessageLog messageLog = new SpyMessageLog(dataFiles[i]);
SpyMessage[] messages = messageLog.restore(commitedTxs);
SpyTxLog txLog = (SpyTxLog)txLogs.get(new Integer(rollOver));
SpyDestination dest = (SpyDestination)queues.get(key);
@@ -506,16 +505,16 @@
try
{
- URL txLogFile = new URL(dataDirURL, TRANS_FILE_NAME + numRollOvers);
- currentTxLog = new SpyTxLog(txLogFile.getFile());
+ File txLogFile = new File(dataDirFile, TRANS_FILE_NAME + numRollOvers);
+ currentTxLog = new SpyTxLog(txLogFile);
messageLogs.put(currentTxLog, new HashMap());
for (Iterator it = queues.values().iterator(); it.hasNext(); )
{
SpyDestination dest = (SpyDestination)it.next();
String key = "" + dest;
- URL logFile = new URL(dataDirURL, dest.toString() + ".dat" +
numRollOvers);
- SpyMessageLog log = new SpyMessageLog(logFile.getFile());
+ File logFile = new File(dataDirFile, dest.toString() + ".dat" +
numRollOvers);
+ SpyMessageLog log = new SpyMessageLog(logFile);
synchronized (messageLogs)
{
@@ -644,12 +643,12 @@
{
HashMap logs = new HashMap();
++numRollOvers;
- SpyTxLog newTxLog = new SpyTxLog(new URL(dataDirURL, TRANS_FILE_NAME +
numRollOvers).getFile());
+ SpyTxLog newTxLog = new SpyTxLog(new File(dataDirFile, TRANS_FILE_NAME +
numRollOvers));
for (Iterator it = queues.values().iterator(); it.hasNext(); )
{
SpyDestination dest = (SpyDestination)it.next();
- SpyMessageLog log = new SpyMessageLog(new URL(dataDirURL,
dest.toString() + ".dat" + numRollOvers).getFile());
+ SpyMessageLog log = new SpyMessageLog(new File(dataDirFile,
dest.toString() + ".dat" + numRollOvers));
LogInfo logInfo = new LogInfo(log, dest, newTxLog);
logs.put("" + dest, logInfo);
}
@@ -661,7 +660,7 @@
}
checkCleanup(oldLog);
}
- catch (java.net.MalformedURLException e)
+ catch (Exception e)
{
JMSException jme = new SpyJMSException("Error rolling over logs to new
files.");
jme.setLinkedException(e);
1.3 +3 -3 jbossmq/src/main/org/jboss/mq/pm/rollinglogged/IntegrityLog.java
Index: IntegrityLog.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/pm/rollinglogged/IntegrityLog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IntegrityLog.java 2001/08/17 03:04:05 1.2
+++ IntegrityLog.java 2001/09/04 02:22:29 1.3
@@ -17,7 +17,7 @@
*
* @created August 16, 2001
* @author: David Maplesden ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class IntegrityLog {
@@ -36,9 +36,9 @@
/////////////////////////////////////////////////////////////////////
// Constructor
/////////////////////////////////////////////////////////////////////
- public IntegrityLog( String fileName )
+ public IntegrityLog( File file )
throws IOException {
- f = new File( fileName );
+ f = file;
raf = new RandomAccessFile( f, "rw" );
this.objectOutput = new MyObjectOutputStream( new MyOutputStream() );
seekEnd();
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development