[JBoss-dev] CVS update: jbossmq/src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java
User: user57 Date: 02/04/03 20:35:07 Modified:src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java Removed: src/main/org/jboss/mq/pm/rollinglogged PersistenceManagerMBean.java Log: o Using ServerConfigLocator instead of ServerConfigImplMBean o Using XDoclet to generate some *MBean interfaces Revision ChangesPath 1.22 +34 -16 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.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- PersistenceManager.java 9 Mar 2002 15:32:34 - 1.21 +++ PersistenceManager.java 4 Apr 2002 04:35:07 - 1.22 @@ -32,14 +32,17 @@ import org.jboss.system.ServiceMBeanSupport; import org.jboss.mq.server.MessageReference; import org.jboss.mq.server.MessageCache; -import org.jboss.system.server.ServerConfigImplMBean; + +import org.jboss.system.server.ServerConfigLocator; /** - * This class manages all persistence related services. + * This class manages all persistence related services. + * + * @jmx:mbean extends="org.jboss.system.ServiceMBean, org.jboss.mq.pm.PersistenceManagerMBean" * - * @author David Maplesden ([EMAIL PROTECTED]) + * @author David Maplesden ([EMAIL PROTECTED]) * @author mailto:[EMAIL PROTECTED]";>David Jencks - * @version$Revision: 1.21 $ + * @version $Revision: 1.22 $ */ public class PersistenceManager extends ServiceMBeanSupport @@ -103,25 +106,26 @@ return messageCache; } - /** -* Insert the method's description here. Creation date: (6/27/2001 12:53:12 -* AM) +* Sets the DataDirectory attribute of the PersistenceManagerMBean object +* +* @jmx:managed-attribute * -* @param newDataDirectory java.lang.String +* @param newDataDirectory The new DataDirectory value */ - public void setDataDirectory(java.lang.String newDataDirectory) + public void setDataDirectory(String newDataDirectory) { dataDirectory = newDataDirectory; } /** -* Insert the method's description here. Creation date: (6/27/2001 12:53:12 -* AM) +* Gets the DataDirectory attribute of the PersistenceManagerMBean object * -* @returnjava.lang.String +* @jmx:managed-attribute +* +* @returnThe DataDirectory value */ - public java.lang.String getDataDirectory() + public String getDataDirectory() { return dataDirectory; } @@ -131,11 +135,26 @@ this.rollOverSize = rollOverSize; } + /** +* Gets maximum number of messages until log rolls over +* +* @jmx:managed-attribute +* +* @return number of messages before log rolls over +*/ public int getRollOverSize() { return rollOverSize; } + /** +* Sets the maxmimum number of messages before log rolls over +* +* @jmx:managed-attribute +* +* @param rollOverSize The maxmimum number of messages before +* rollover occurs +*/ public Object getInstance() { return this; @@ -233,9 +252,8 @@ { log.debug("Using new rolling logged persistence manager."); - // Get the system home directory (may want to use dataDir) - File systemHomeDir = (File) - server.getAttribute(ServerConfigImplMBean.OBJECT_NAME, "ServerHomeDir"); + // Get the system home directory + File systemHomeDir = ServerConfigLocator.locate().getServerHomeDir(); dataDir = new File(systemHomeDir, dataDirectory); if (log.isDebugEnabled()) { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbossmq/src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java
User: lqd Date: 02/02/19 08:11:22 Modified:src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java Log: - add ability to set rollover size via JMX (was fix at 1000 before) - yank dead (commented out) code - replace custom "DEBUG" logging to System.out to use log4j - clean up ambigious use of "SpyMessageLog log" -> change to "messageLog" Revision ChangesPath 1.18 +46 -229 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.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- PersistenceManager.java 13 Feb 2002 04:26:38 - 1.17 +++ PersistenceManager.java 19 Feb 2002 16:11:22 - 1.18 @@ -39,15 +39,13 @@ * * @author David Maplesden ([EMAIL PROTECTED]) * @author mailto:[EMAIL PROTECTED]";>David Jencks - * @version$Revision: 1.17 $ + * @version$Revision: 1.18 $ */ public class PersistenceManager extends ServiceMBeanSupport implements org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean { - public final static int ROLL_OVER_SIZE = 1000; public final static String TRANS_FILE_NAME = "transactions.dat"; - public final static boolean DEBUG = false; protected static int MAX_POOL_SIZE = 50; @@ -74,7 +72,7 @@ TxManager txManager; private String dataDirectory; - + private int rollOverSize; private HashMap unrestoredMessages = new HashMap(); @@ -84,7 +82,8 @@ * * @exception javax.jms.JMSException Description of Exception */ - public PersistenceManager() throws javax.jms.JMSException + public PersistenceManager() + throws javax.jms.JMSException { txManager = new TxManager(this); } @@ -127,13 +126,21 @@ return dataDirectory; } + public void setRollOverSize( int rollOverSize ) + { + this.rollOverSize = rollOverSize; + } + + public int getRollOverSize() + { + return rollOverSize; + } public Object getInstance() { return this; } - /** * getTxManager method comment. * @@ -144,74 +151,14 @@ return txManager; } - /*public void initQueue(SpyDestination dest) throws javax.jms.JMSException - { - log.error("You called the wrong initQueue method"); - } - */ /** * #Description of the Method * * @param destDescription of Parameter * @exception javax.jms.JMSException Description of Exception */ - // public void initQueue(JMSDestination jmsDest) throws javax.jms.JMSException - //{ - // restoreDestination(jmsDest); - /* - SpyDestination dest = jmsDest.getSpyDestination(); - - String destName = dest.toString(); - //really? what about multiple subscribers on a topic? - queues.put(destName, dest); - //new - restoreDestination(jmsDest); - SpyTxLog txLog = null; - - // if called before we have been started there is no need to setup log files - if(currentTxLog == null) - return; - - HashMap logs; - synchronized (messageLogs) - { - logs = (HashMap)messageLogs.get(currentTxLog); - if (logs == null) - { -logs = new HashMap(); -messageLogs.put(currentTxLog, logs); - } - synchronized (logs) - { -LogInfo logInfo = (LogInfo)logs.get(destName); - -if (logInfo == null) -{ - try - { - SpyMessageLog log = new SpyMessageLog(new File(dataDir, destName + ".dat" + numRollOvers)); - logInfo = new LogInfo(log, dest, currentTxLog); - logs.put(destName, logInfo); - } - catch (Exception e) - { - JMSException jme = new SpyJMSException("Error rolling over logs to new files."); - jme.setLinkedException(e); - throw jme; - } -} - } - } -*/ - // } - - /** -* #Description of the Method -* -* @param destDescription of Parameter -* @exception javax.jms.JMSException Description of Exception -*/ - public void destroyQueue(SpyDestination dest) throws javax.jms.JMSException + public void destroyQueue(SpyDestination dest) + throws javax.jms.JMSException { try @@ -233,9
[JBoss-dev] CVS update: jbossmq/src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java
User: user57 Date: 02/02/12 20:26:38 Modified:src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java Log: o These are all kinda related, so I am commiting them together o This is the second half of the migration to using ObjectName OBJECT_NAME o Not using jboss.system.* properties anywhere (one place in testsuite which I am ignoring for now) o StateManager will now read its config from a url (configURL), and only attempt to write it back out if that is a file URL. Need to fix this to not need to write back to a config file. o Still setting jboss.home & jboss.system.home, but use ServerConfigMBean to get the proper bits, will eventually abstract all file access out o Added a simple locator to find a mbean server. This is trivial code, but helps clean up client code and makes it obvious what it does. Revision ChangesPath 1.17 +34 -43 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.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- PersistenceManager.java 3 Jan 2002 04:00:54 - 1.16 +++ PersistenceManager.java 13 Feb 2002 04:26:38 - 1.17 @@ -4,9 +4,8 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ -package org.jboss.mq.pm.rollinglogged; - +package org.jboss.mq.pm.rollinglogged; import java.io.File; import java.net.URL; @@ -33,17 +32,19 @@ import org.jboss.system.ServiceMBeanSupport; import org.jboss.mq.server.MessageReference; import org.jboss.mq.server.MessageCache; +import org.jboss.system.ServerConfigMBean; /** * This class manages all persistence related services. * * @author David Maplesden ([EMAIL PROTECTED]) * @author mailto:[EMAIL PROTECTED]";>David Jencks - * @version$Revision: 1.16 $ + * @version$Revision: 1.17 $ */ -public class PersistenceManager extends ServiceMBeanSupport implements org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean +public class PersistenceManager + extends ServiceMBeanSupport + implements org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean { - public final static int ROLL_OVER_SIZE = 1000; public final static String TRANS_FILE_NAME = "transactions.dat"; public final static boolean DEBUG = false; @@ -69,7 +70,7 @@ HashMap transToTxLogs = new HashMap(); // The directory where persistence data should be stored - File dataDirFile; + File dataDir; TxManager txManager; private String dataDirectory; @@ -134,16 +135,6 @@ /** -* Gets the Name attribute of the PersistenceManager object -* -* @returnThe Name value -*/ - public String getName() - { - return "JBossMQ-PersistenceManager"; - } - - /** * getTxManager method comment. * * @returnThe TxManager value @@ -198,7 +189,7 @@ { try { - SpyMessageLog log = new SpyMessageLog(new File(dataDirFile, destName + ".dat" + numRollOvers)); + SpyMessageLog log = new SpyMessageLog(new File(dataDir, destName + ".dat" + numRollOvers)); logInfo = new LogInfo(log, dest, currentTxLog); logs.put(destName, logInfo); } @@ -286,33 +277,33 @@ } - /** -* Describe startService method here. -* -* @exception Exception if an error occurs +* Setup the data directory, where messages will be stored, connects +* to the message cache and restores transactions. */ public void startService() throws Exception { log.debug("Using new rolling logged persistence manager."); - log.warn("using jboss.system.home property"); - File jbossHome = new File(System.getProperty("jboss.system.home")); - dataDirFile = new File(jbossHome, dataDirectory); - dataDirFile.mkdirs(); - if( !dataDirFile.isDirectory() ) - throw new Exception("The data directory is not valid: "+dataDirFile.getCanonicalPath()); - - messageCache = (MessageCache)getServer().invoke(messageCacheName, "getInstance", new Object[] {}, new String[] {}); + // Get the system home directory (may want to use dataDir) + File systemHomeDir = (File) + server.getAttribute(ServerConfigMBean.OBJECT_NAME, "HomeDir"); + + dataDir = new File(systemHomeDir, dataDirectory); + if (log.isDebugEnabled()) { + log.debug("Using data directory: " +
[JBoss-dev] CVS update: jbossmq/src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java SpyMessageLog.java SpyTxLog.java
User: d_jencks Date: 01/11/10 13:38:05 Modified:src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java SpyMessageLog.java SpyTxLog.java Log: Changed mbean dependencies to work directly by mbean-references: eliminated depends tag from *service.xml files Revision ChangesPath 1.13 +293 -60 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.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- PersistenceManager.java 2001/10/29 07:32:26 1.12 +++ PersistenceManager.java 2001/11/10 21:38:05 1.13 @@ -6,8 +6,11 @@ */ package org.jboss.mq.pm.rollinglogged; + + import java.io.File; import java.net.URL; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -15,25 +18,28 @@ import java.util.TreeSet; import javax.jms.JMSException; import javax.management.ObjectName; - import javax.naming.InitialContext; import org.jboss.mq.ConnectionToken; - import org.jboss.mq.SpyDestination; import org.jboss.mq.SpyJMSException; import org.jboss.mq.SpyMessage; import org.jboss.mq.pm.TxManager; import org.jboss.mq.server.JMSDestination; +import org.jboss.mq.server.JMSQueue; import org.jboss.mq.server.JMSServer; +import org.jboss.mq.server.JMSTopic; +import org.jboss.mq.server.PersistentQueue; import org.jboss.mq.xml.XElement; import org.jboss.system.ServiceMBeanSupport; import org.jboss.mq.server.MessageReference; +import org.jboss.mq.server.MessageCache; /** * This class manages all persistence related services. * * @author David Maplesden ([EMAIL PROTECTED]) - * @version$Revision: 1.12 $ + * @author mailto:[EMAIL PROTECTED]";>David Jencks + * @version$Revision: 1.13 $ */ public class PersistenceManager extends ServiceMBeanSupport implements org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean { @@ -44,13 +50,16 @@ protected static int MAX_POOL_SIZE = 50; + private ObjectName messageCacheName; + private MessageCache messageCache; + protected java.util.ArrayList listPool = new java.util.ArrayList(); protected java.util.ArrayList txPool = new java.util.ArrayList(); protected int messageCounter = 0; int numRollOvers = 0; HashMap queues = new HashMap(); - // Log file used to store commited transactions. + // Log file used to store committed transactions. SpyTxLog currentTxLog; long nextTxId = Long.MIN_VALUE; // Maps txLogs to Maps of SpyDestinations to SpyMessageLogs @@ -65,6 +74,10 @@ private String dataDirectory; + + private HashMap unrestoredMessages = new HashMap(); + + /** * NewPersistenceManager constructor. * @@ -75,6 +88,21 @@ txManager = new TxManager(this); } + public ObjectName getMessageCache() + { + return messageCacheName; + } + + public void setMessageCache(ObjectName messageCache) + { + this.messageCacheName = messageCache; + } + + public MessageCache getMessageCacheInstance() + { + return messageCache; + } + /** * Insert the method's description here. Creation date: (6/27/2001 12:53:12 @@ -98,6 +126,13 @@ return dataDirectory; } + + public org.jboss.mq.pm.PersistenceManager getInstance() + { + return this; + } + + /** * Gets the Name attribute of the PersistenceManager object * @@ -118,17 +153,28 @@ return txManager; } + /*public void initQueue(SpyDestination dest) throws javax.jms.JMSException + { + log.error("You called the wrong initQueue method"); + } + */ /** * #Description of the Method * * @param destDescription of Parameter * @exception javax.jms.JMSException Description of Exception */ - public void initQueue(SpyDestination dest) throws javax.jms.JMSException - { - - String key = "" + dest; - queues.put(key, dest); + // public void initQueue(JMSDestination jmsDest) throws javax.jms.JMSException + //{ + // restoreDestination(jmsDest); + /* + SpyDestination dest = jmsDest.getSpyDestination(); + + String destName = dest.toString(); + //really? what about multiple subscribers on a topic? + queues.put(destName, dest); + //new + restoreDestination(jmsDest); SpyTxLog txLog = null; // if called bef
[JBoss-dev] CVS update: jbossmq/src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java
User: chirino Date: 01/08/31 20:01:00 Modified:src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java Log: Fixing compile problems due to migration of classes from jboss.util to jboss.system Revision ChangesPath 1.5 +456 -285 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PersistenceManager.java 2001/08/30 02:35:55 1.4 +++ PersistenceManager.java 2001/09/01 03:01:00 1.5 @@ -1,3 +1,9 @@ +/* + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ package org.jboss.mq.pm.rollinglogged; import java.net.URL; @@ -6,7 +12,6 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.TreeSet; - import javax.jms.JMSException; import javax.management.*; @@ -20,53 +25,54 @@ 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 David Maplesden ([EMAIL PROTECTED]) - * @createdAugust 16, 2001 - * @version$Revision: 1.4 $ + * @version$Revision: 1.5 $ */ -public class PersistenceManager extends org.jboss.system.ServiceMBeanSupport implements org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean { +public class PersistenceManager extends ServiceMBeanSupport implements org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean +{ + public final static int ROLL_OVER_SIZE = 1000; + public final static String TRANS_FILE_NAME = "transactions.dat"; + public final static boolean DEBUG = false; + + protected static int MAX_POOL_SIZE = 50; + protected java.util.ArrayList listPool = new java.util.ArrayList(); protected java.util.ArrayList txPool = new java.util.ArrayList(); - protected intmessageCounter = 0; - int numRollOvers = 0; - HashMap queues = new HashMap(); + protected int messageCounter = 0; + int numRollOvers = 0; + HashMap queues = new HashMap(); // Log file used to store commited transactions. - SpyTxLog currentTxLog; - long nextTxId = Long.MIN_VALUE; + SpyTxLog currentTxLog; + long nextTxId = Long.MIN_VALUE; // Maps txLogs to Maps of SpyDestinations to SpyMessageLogs - HashMap messageLogs = null; + HashMap messageLogs = new HashMap(); // Maps transactionIds to txInfos - HashMap transToTxLogs = new HashMap(); + HashMap transToTxLogs = new HashMap(); - // The directory where persistence data should be stored - URL dataDirURL; - TxManagertxManager; - private String dataDirectory; - public final static int ROLL_OVER_SIZE = 1000; - public final static String TRANS_FILE_NAME = "transactions.dat"; - public final static boolean DEBUG = false; + // The directory where persistence data should be stored + URL dataDirURL; + TxManager txManager; - protected static int MAX_POOL_SIZE = 50; + 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); } @@ -76,7 +82,8 @@ * * @param newDataDirectory java.lang.String */ - public void setDataDirectory( java.lang.String newDataDirectory ) { + public void setDataDirectory(java.lang.String newDataDirectory) + { dataDirectory = newDataDirectory; } @@ -86,11 +93,18 @@ * * @returnjava.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 +* +* @returnThe Name value +*/ + public String getName() + { return "JBossMQ-PersistenceManager"; } @@ -99,39 +113,49 @@ * * @returnThe TxManager value */ - public org.jboss.mq.pm.TxManager getTxManager() { + public org.jboss.mq.pm.TxManager g
[JBoss-dev] CVS update: jbossmq/src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java
User: mnf999 Date: 01/08/29 19:35:55 Modified:src/main/org/jboss/mq/pm/rollinglogged PersistenceManager.java PersistenceManagerMBean.java Log: just package names, nothing more Revision ChangesPath 1.4 +3 -3 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- PersistenceManager.java 2001/08/17 03:04:05 1.3 +++ PersistenceManager.java 2001/08/30 02:35:55 1.4 @@ -21,16 +21,16 @@ import org.jboss.mq.server.JMSServer; import org.jboss.mq.xml.XElement; -import org.jboss.util.ServiceMBeanSupport; +import org.jboss.system.ServiceMBeanSupport; /** * This class manages all persistence related services. * * @author David Maplesden ([EMAIL PROTECTED]) * @createdAugust 16, 2001 - * @version$Revision: 1.3 $ + * @version$Revision: 1.4 $ */ -public class PersistenceManager extends org.jboss.util.ServiceMBeanSupport implements org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean { +public class PersistenceManager extends org.jboss.system.ServiceMBeanSupport implements org.jboss.mq.pm.PersistenceManager, PersistenceManagerMBean { protected java.util.ArrayList listPool = new java.util.ArrayList(); protected java.util.ArrayList txPool = new java.util.ArrayList(); 1.3 +2 -2 jbossmq/src/main/org/jboss/mq/pm/rollinglogged/PersistenceManagerMBean.java Index: PersistenceManagerMBean.java === RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/pm/rollinglogged/PersistenceManagerMBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PersistenceManagerMBean.java 2001/08/17 03:04:05 1.2 +++ PersistenceManagerMBean.java 2001/08/30 02:35:55 1.3 @@ -13,10 +13,10 @@ * @author Vincent Sheffer ([EMAIL PROTECTED]) * @createdAugust 16, 2001 * @see - * @version$Revision: 1.2 $ + * @version$Revision: 1.3 $ */ public interface PersistenceManagerMBean - extends org.jboss.util.ServiceMBean { + extends org.jboss.system.ServiceMBean { // Constants - public final static String OBJECT_NAME = ":service=JBossMQ"; ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development