User: chirino
Date: 01/08/31 20:01:00
Modified: src/main/org/jboss/mq/pm/logged PersistenceManager.java
PersistenceManagerMBean.java
Log:
Fixing compile problems due to migration of classes from jboss.util to jboss.system
Revision Changes Path
1.4 +189 -88 jbossmq/src/main/org/jboss/mq/pm/logged/PersistenceManager.java
Index: PersistenceManager.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/pm/logged/PersistenceManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PersistenceManager.java 2001/08/30 02:35:55 1.3
+++ PersistenceManager.java 2001/09/01 03:01:00 1.4
@@ -1,5 +1,5 @@
/*
- * JBossMQ, the OpenSource JMS implementation
+ * JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -13,8 +13,12 @@
import java.util.TreeSet;
import javax.jms.JMSException;
+
import javax.management.*;
+
+
+
import javax.naming.InitialContext;
import org.jboss.mq.ConnectionToken;
@@ -25,37 +29,44 @@
import org.jboss.mq.server.JMSDestination;
import org.jboss.mq.server.JMSServer;
import org.jboss.mq.xml.XElement;
-
import org.jboss.system.ServiceMBeanSupport;
/**
* This class manages all persistence related services.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
- * @created August 16, 2001
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
-public class PersistenceManager extends org.jboss.system.ServiceMBeanSupport
implements PersistenceManagerMBean, org.jboss.mq.pm.PersistenceManager {
+public class PersistenceManager extends ServiceMBeanSupport implements
PersistenceManagerMBean, org.jboss.mq.pm.PersistenceManager
+{
// Log file used to store commited transactions.
- SpyTxLog spyTxLog;
+ SpyTxLog spyTxLog;
// Maps SpyDestinations to SpyMessageLogs
- HashMap messageLogs = new HashMap();
+ HashMap messageLogs = new HashMap();
+
+
+
+
+
+
+
+
// The directory where persistence data should be stored
- URL dataDirURL;
- TxManager txManager;
+ URL dataDirURL;
+ TxManager txManager;
- private String dataDirectory;
+ private String dataDirectory;
/**
* NewPersistenceManager constructor.
*
* @exception javax.jms.JMSException Description of Exception
*/
- public PersistenceManager()
- throws javax.jms.JMSException {
- txManager = new TxManager( this );
+ public PersistenceManager() throws javax.jms.JMSException
+ {
+ txManager = new TxManager(this);
}
@@ -65,7 +76,8 @@
*
* @param newDataDirectory java.lang.String
*/
- public void setDataDirectory( java.lang.String newDataDirectory ) {
+ public void setDataDirectory(java.lang.String newDataDirectory)
+ {
dataDirectory = newDataDirectory;
}
@@ -75,11 +87,18 @@
*
* @return java.lang.String
*/
- public java.lang.String getDataDirectory() {
+ public java.lang.String getDataDirectory()
+ {
return dataDirectory;
}
- public String getName() {
+ /**
+ * Gets the Name attribute of the PersistenceManager object
+ *
+ * @return The Name value
+ */
+ public String getName()
+ {
return "JBossMQ-PersistenceManager";
}
@@ -88,169 +107,251 @@
*
* @return The TxManager value
*/
- public org.jboss.mq.pm.TxManager getTxManager() {
+ public org.jboss.mq.pm.TxManager getTxManager()
+ {
return txManager;
}
- public void initService()
- throws Exception {
+ /**
+ * #Description of the Method
+ *
+ * @exception Exception Description of Exception
+ */
+ public void initService() throws Exception
+ {
- URL configFile = getClass().getClassLoader().getResource( "jboss.jcml" );
+ URL configFile = getClass().getClassLoader().getResource("jboss.jcml");
- dataDirURL = new URL( configFile, dataDirectory );
- URL txLogFile = new URL( dataDirURL, "transactions.dat" );
- spyTxLog = new SpyTxLog( txLogFile.getFile() );
+ dataDirURL = new URL(configFile, dataDirectory);
+ URL txLogFile = new URL(dataDirURL, "transactions.dat");
+ spyTxLog = new SpyTxLog(txLogFile.getFile());
//Get an InitialContext
- JMSServer server = ( JMSServer )getServer().invoke( new ObjectName(
org.jboss.mq.server.JBossMQServiceMBean.OBJECT_NAME ), "getJMSServer", new Object[]{},
new String[]{} );
- server.setPersistenceManager( this );
+ JMSServer server = (JMSServer)getServer().invoke(new
ObjectName(org.jboss.mq.server.JBossMQServiceMBean.OBJECT_NAME), "getJMSServer", new
Object[]{}, new String[]{});
+ server.setPersistenceManager(this);
}
- public void startService()
- throws Exception {
+ /**
+ * #Description of the Method
+ *
+ * @exception Exception Description of Exception
+ */
+ public void startService() throws Exception
+ {
- JMSServer server = ( JMSServer )getServer().invoke( new ObjectName(
org.jboss.mq.server.JBossMQServiceMBean.OBJECT_NAME ), "getJMSServer", new Object[]{},
new String[]{} );
- restore( server );
+ JMSServer server = (JMSServer)getServer().invoke(new
ObjectName(org.jboss.mq.server.JBossMQServiceMBean.OBJECT_NAME), "getJMSServer", new
Object[]{}, new String[]{});
+ restore(server);
}
- public void destroyQueue( SpyDestination dest )
- throws javax.jms.JMSException {
+ /**
+ * #Description of the Method
+ *
+ * @param dest Description of Parameter
+ * @exception javax.jms.JMSException Description of Exception
+ */
+ public void destroyQueue(SpyDestination dest) throws javax.jms.JMSException
+ {
- try {
+ try
+ {
- URL logFile = new URL( dataDirURL, dest.toString() + ".dat" );
- java.io.File file = new java.io.File( logFile.getFile() );
+ URL logFile = new URL(dataDirURL, dest.toString() + ".dat");
+ java.io.File file = new java.io.File(logFile.getFile());
- SpyMessageLog log = ( SpyMessageLog )messageLogs.remove( "" + dest );
- if ( log == null ) {
- throw new SpyJMSException( "The persistence log was never initialized"
);
+ SpyMessageLog log = (SpyMessageLog)messageLogs.remove("" + dest);
+ if (log == null)
+ {
+ throw new SpyJMSException("The persistence log was never initialized");
}
log.close();
file.delete();
- } catch ( javax.jms.JMSException e ) {
+ }
+ catch (javax.jms.JMSException e)
+ {
throw e;
- } catch ( Exception e ) {
- javax.jms.JMSException newE = new javax.jms.JMSException( "Invalid
configuration." );
- newE.setLinkedException( e );
+ }
+ catch (Exception e)
+ {
+ javax.jms.JMSException newE = new javax.jms.JMSException("Invalid
configuration.");
+ newE.setLinkedException(e);
throw newE;
}
}
- public void initQueue( SpyDestination dest )
- throws javax.jms.JMSException {
+ /**
+ * #Description of the Method
+ *
+ * @param dest Description of Parameter
+ * @exception javax.jms.JMSException Description of Exception
+ */
+ public void initQueue(SpyDestination dest) throws javax.jms.JMSException
+ {
- try {
+ try
+ {
- URL logFile = new URL( dataDirURL, dest.toString() + ".dat" );
- SpyMessageLog log = new SpyMessageLog( logFile.getFile() );
+ URL logFile = new URL(dataDirURL, dest.toString() + ".dat");
+ SpyMessageLog log = new SpyMessageLog(logFile.getFile());
- LogInfo info = new LogInfo( log, dest );
+ LogInfo info = new LogInfo(log, dest);
- messageLogs.put( "" + dest, info );
+ messageLogs.put("" + dest, info);
- } catch ( javax.jms.JMSException e ) {
+ }
+ catch (javax.jms.JMSException e)
+ {
throw e;
- } catch ( Exception e ) {
- javax.jms.JMSException newE = new javax.jms.JMSException( "Invalid
configuration." );
- newE.setLinkedException( e );
+ }
+ catch (Exception e)
+ {
+ javax.jms.JMSException newE = new javax.jms.JMSException("Invalid
configuration.");
+ newE.setLinkedException(e);
throw newE;
}
}
- public void add( org.jboss.mq.SpyMessage message, org.jboss.mq.pm.Tx txId )
- throws javax.jms.JMSException {
+ /**
+ * #Description of the Method
+ *
+ * @param message Description of Parameter
+ * @param txId Description of Parameter
+ * @exception javax.jms.JMSException Description of Exception
+ */
+ public void add(org.jboss.mq.SpyMessage message, org.jboss.mq.pm.Tx txId) throws
javax.jms.JMSException
+ {
LogInfo logInfo;
- synchronized ( messageLogs ) {
- logInfo = ( LogInfo )messageLogs.get( "" + message.getJMSDestination() );
+ synchronized (messageLogs)
+ {
+ logInfo = (LogInfo)messageLogs.get("" + message.getJMSDestination());
}
- if ( logInfo == null ) {
- throw new javax.jms.JMSException( "Destination was not initalized with the
PersistenceManager" );
+ if (logInfo == null)
+ {
+ throw new javax.jms.JMSException("Destination was not initalized with the
PersistenceManager");
}
- logInfo.log.add( message, txId );
+ logInfo.log.add(message, txId);
}
- public void commitPersistentTx( org.jboss.mq.pm.Tx txId )
- throws javax.jms.JMSException {
- spyTxLog.commitTx( txId );
+ /**
+ * #Description of the Method
+ *
+ * @param txId Description of Parameter
+ * @exception javax.jms.JMSException Description of Exception
+ */
+ public void commitPersistentTx(org.jboss.mq.pm.Tx txId) throws
javax.jms.JMSException
+ {
+ spyTxLog.commitTx(txId);
}
- public org.jboss.mq.pm.Tx createPersistentTx()
- throws javax.jms.JMSException {
+ /**
+ * #Description of the Method
+ *
+ * @return Description of the Returned Value
+ * @exception javax.jms.JMSException Description of Exception
+ */
+ public org.jboss.mq.pm.Tx createPersistentTx() throws javax.jms.JMSException
+ {
return spyTxLog.createTx();
}
- public void remove( org.jboss.mq.SpyMessage message, org.jboss.mq.pm.Tx txId )
- throws javax.jms.JMSException {
+ /**
+ * #Description of the Method
+ *
+ * @param message Description of Parameter
+ * @param txId Description of Parameter
+ * @exception javax.jms.JMSException Description of Exception
+ */
+ public void remove(org.jboss.mq.SpyMessage message, org.jboss.mq.pm.Tx txId)
throws javax.jms.JMSException
+ {
LogInfo logInfo;
- synchronized ( messageLogs ) {
- logInfo = ( LogInfo )messageLogs.get( "" + message.getJMSDestination() );
+ synchronized (messageLogs)
+ {
+ logInfo = (LogInfo)messageLogs.get("" + message.getJMSDestination());
}
- if ( logInfo == null ) {
- throw new javax.jms.JMSException( "Destination was not initalized with the
PersistenceManager" );
+ if (logInfo == null)
+ {
+ throw new javax.jms.JMSException("Destination was not initalized with the
PersistenceManager");
}
- logInfo.log.remove( message, txId );
+ logInfo.log.remove(message, txId);
}
- public void restore( org.jboss.mq.server.JMSServer server )
- throws javax.jms.JMSException {
+ /**
+ * #Description of the Method
+ *
+ * @param server Description of Parameter
+ * @exception javax.jms.JMSException Description of Exception
+ */
+ public void restore(org.jboss.mq.server.JMSServer server) throws
javax.jms.JMSException
+ {
TreeSet commitedTXs = spyTxLog.restore();
HashMap clone;
- synchronized ( messageLogs ) {
- clone = ( HashMap )messageLogs.clone();
+ synchronized (messageLogs)
+ {
+ clone = (HashMap)messageLogs.clone();
}
Iterator iter = clone.values().iterator();
- while ( iter.hasNext() ) {
+ while (iter.hasNext())
+ {
- LogInfo logInfo = ( LogInfo )iter.next();
+ LogInfo logInfo = (LogInfo)iter.next();
- JMSDestination q = server.getJMSDestination( logInfo.destination );
+ JMSDestination q = server.getJMSDestination(logInfo.destination);
- SpyMessage rebuild[] = logInfo.log.restore( commitedTXs );
+ SpyMessage rebuild[] = logInfo.log.restore(commitedTXs);
//TODO: make sure this lock is good enough
- synchronized ( q ) {
- for ( int i = 0; i < rebuild.length; i++ ) {
- q.restoreMessage( rebuild[i] );
+ synchronized (q)
+ {
+ for (int i = 0; i < rebuild.length; i++)
+ {
+ q.restoreMessage(rebuild[i]);
}
}
}
}
- public void rollbackPersistentTx( org.jboss.mq.pm.Tx txId )
- throws javax.jms.JMSException {
- spyTxLog.rollbackTx( txId );
+ /**
+ * #Description of the Method
+ *
+ * @param txId Description of Parameter
+ * @exception javax.jms.JMSException Description of Exception
+ */
+ public void rollbackPersistentTx(org.jboss.mq.pm.Tx txId) throws
javax.jms.JMSException
+ {
+ spyTxLog.rollbackTx(txId);
}
/**
- * @created August 16, 2001
+ * #Description of the Class
*/
- static class LogInfo {
+ static class LogInfo
+ {
SpyMessageLog log;
SpyDestination destination;
- LogInfo( SpyMessageLog log, SpyDestination destination ) {
+ LogInfo(SpyMessageLog log, SpyDestination destination)
+ {
this.log = log;
this.destination = destination;
}
1.4 +17 -43
jbossmq/src/main/org/jboss/mq/pm/logged/PersistenceManagerMBean.java
Index: PersistenceManagerMBean.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/pm/logged/PersistenceManagerMBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PersistenceManagerMBean.java 2001/08/30 02:35:55 1.3
+++ PersistenceManagerMBean.java 2001/09/01 03:01:00 1.4
@@ -1,62 +1,36 @@
-package org.jboss.mq.pm.logged;
-
-/*
- * jBoss, the OpenSource EJB server
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-/*
- * jBoss, the OpenSource EJB server
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-/*
- * jBoss, the OpenSource EJB server
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
/*
- * jBoss, the OpenSource EJB server
+ * JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
+package org.jboss.mq.pm.logged;
-/*
- * jBoss, the OpenSource EJB server
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
+import org.jboss.system.ServiceMBean;
/**
* <description>MBean interface for the JBossMQ JMX service.
*
* @author Vincent Sheffer ([EMAIL PROTECTED])
- * @created August 16, 2001
* @see <related>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public interface PersistenceManagerMBean
- extends org.jboss.system.ServiceMBean {
- // Constants -----------------------------------------------------
+ extends ServiceMBean
+{
public final static String OBJECT_NAME = ":service=JBossMQ";
-
- // Public --------------------------------------------------------
-
-
- // Public --------------------------------------------------------
-
- // Public --------------------------------------------------------
- // Public --------------------------------------------------------
+ /**
+ * Gets the DataDirectory attribute of the PersistenceManagerMBean object
+ *
+ * @return The DataDirectory value
+ */
public java.lang.String getDataDirectory();
- public void setDataDirectory( java.lang.String newDataDirectory );
+ /**
+ * Sets the DataDirectory attribute of the PersistenceManagerMBean object
+ *
+ * @param newDataDirectory The new DataDirectory value
+ */
+ public void setDataDirectory(java.lang.String newDataDirectory);
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development