站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 messaging API Documentation 英文版文档

PersistenceManager (JBoss Messaging API) - JBoss 3.2.7 messaging API Documentation 英文版文档


org.jboss.mq.pm.file
Class PersistenceManager

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.mq.pm.file.PersistenceManager
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, PersistenceManager, PersistenceManagerMBean, PersistenceManagerMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class PersistenceManager
extends org.jboss.system.ServiceMBeanSupport
implements PersistenceManagerMBean, PersistenceManager

This class manages all persistence related services for file based persistence.

Version:
$Revision: 1.26.2.2 $
Author:
Paul Kendall (paul.kendall@orion.co.nz)

Field Summary
protected static int MAX_POOL_SIZE
           
protected  long tidcounter
           
protected  ArrayList txPool
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Fields inherited from interface org.jboss.mq.pm.PersistenceManagerMBean
OBJECT_NAME
 
Constructor Summary
PersistenceManager()
          Sets up the transaction manager.
 
Method Summary
 void add(MessageReference messageRef, Tx txId)
          #Description of the Method
 void closeQueue(JMSDestination jmsDest, SpyDestination dest)
          Close a queue
 void commitPersistentTx(Tx txId)
          #Description of the Method
 Tx createPersistentTx()
          #Description of the Method
protected  File createTxFile(Tx txId)
           
protected  void deleteTxFile(File file)
           
static String encodeFileName(String name)
          Used to encode any string into a string that is safe to use as a file name on most operating systems.
 String getDataDirectory()
          Gets the DataDirectory attribute of the PersistenceManager object
 Object getInstance()
          Get the persistence manager instance
 javax.management.ObjectName getMessageCache()
          Get the object name of the cache
 MessageCache getMessageCacheInstance()
          Get the message cache
protected  org.jboss.mq.pm.file.PersistenceManager.TxInfo getTxInfo(File f)
           
 TxManager getTxManager()
          Gets the TxManager attribute of the PersistenceManager object
 void initQueue(SpyDestination dest)
           
protected  ArrayList readTxFile(File file)
           
protected  void releaseTxInfo(org.jboss.mq.pm.file.PersistenceManager.TxInfo info)
           
 void remove(MessageReference messageRef, Tx txId)
          #Description of the Method
 void restoreDestination(JMSDestination jmsDest)
          The restoreDestination method is called by a queue or topic on startup.
 void restoreQueue(JMSDestination jmsDest, SpyDestination dest)
          The restoreQueue method restores the messages for a SpyDestination to its queue by sending them to the associated JMSDestination.
 void rollbackPersistentTx(Tx txId)
          #Description of the Method
 void setDataDirectory(String newDataDirectory)
          Sets the DataDirectory attribute of the PersistenceManager object
 void setMessageCache(javax.management.ObjectName messageCache)
          Set the object name of the message cache
 void startService()
          Setup the data directory, where messages will be stored, connects to the message cache and restores transactions.
protected  boolean testRollBackTx(Long tx, ArrayList removingMessages)
           
 void update(MessageReference messageRef, Tx txId)
          #Description of the Method
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

MAX_POOL_SIZE

protected static final int MAX_POOL_SIZE
See Also:
Constant Field Values

txPool

protected ArrayList txPool

tidcounter

protected long tidcounter
Constructor Detail

PersistenceManager

public PersistenceManager()
                   throws javax.jms.JMSException
Sets up the transaction manager.

Method Detail

getInstance

public Object getInstance()
Description copied from interface: PersistenceManagerMBean
Get the persistence manager instance

Specified by:
getInstance in interface PersistenceManagerMBean
Returns:
the persistence manager

getMessageCache

public javax.management.ObjectName getMessageCache()
Description copied from interface: PersistenceManagerMBean
Get the object name of the cache

Specified by:
getMessageCache in interface PersistenceManagerMBean
Returns:
the object name of the cache

setMessageCache

public void setMessageCache(javax.management.ObjectName messageCache)
Description copied from interface: PersistenceManagerMBean
Set the object name of the message cache

Specified by:
setMessageCache in interface PersistenceManagerMBean
Parameters:
messageCache - the object name

getMessageCacheInstance

public MessageCache getMessageCacheInstance()
Description copied from interface: PersistenceManager
Get the message cache

Specified by:
getMessageCacheInstance in interface PersistenceManager
Returns:
the instance of the message cache

setDataDirectory

public void setDataDirectory(String newDataDirectory)
Sets the DataDirectory attribute of the PersistenceManager object

Specified by:
setDataDirectory in interface PersistenceManagerMBean
Parameters:
newDataDirectory - The new DataDirectory value

getDataDirectory

public String getDataDirectory()
Gets the DataDirectory attribute of the PersistenceManager object

Specified by:
getDataDirectory in interface PersistenceManagerMBean
Returns:
The DataDirectory value

getTxManager

public TxManager getTxManager()
Gets the TxManager attribute of the PersistenceManager object

Specified by:
getTxManager in interface PersistenceManager
Returns:
The TxManager value

startService

public void startService()
                  throws Exception
Setup the data directory, where messages will be stored, connects to the message cache and restores transactions.

Throws:
Exception

restoreDestination

public void restoreDestination(JMSDestination jmsDest)
                        throws javax.jms.JMSException
The restoreDestination method is called by a queue or topic on startup. The method sends all the pre-restored messages to the JMSDestination to get them back into the in-memory queue.

Parameters:
jmsDest - a JMSDestination value
Throws:
javax.jms.JMSException - if an error occurs

restoreQueue

public void restoreQueue(JMSDestination jmsDest,
                         SpyDestination dest)
                  throws javax.jms.JMSException
The restoreQueue method restores the messages for a SpyDestination to its queue by sending them to the associated JMSDestination.

Specified by:
restoreQueue in interface PersistenceManager
Parameters:
jmsDest - a JMSDestination value
dest - a SpyDestination value
Throws:
javax.jms.JMSException - if an error occurs

initQueue

public void initQueue(SpyDestination dest)
               throws javax.jms.JMSException
Throws:
javax.jms.JMSException

add

public void add(MessageReference messageRef,
                Tx txId)
         throws javax.jms.JMSException
#Description of the Method

Specified by:
add in interface PersistenceManager
Parameters:
txId - Description of Parameter
messageRef - the message
Throws:
javax.jms.JMSException - Description of Exception

commitPersistentTx

public void commitPersistentTx(Tx txId)
                        throws javax.jms.JMSException
#Description of the Method

Specified by:
commitPersistentTx in interface PersistenceManager
Parameters:
txId - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

createPersistentTx

public Tx createPersistentTx()
                      throws javax.jms.JMSException
#Description of the Method

Specified by:
createPersistentTx in interface PersistenceManager
Returns:
Description of the Returned Value
Throws:
javax.jms.JMSException - Description of Exception

remove

public void remove(MessageReference messageRef,
                   Tx txId)
            throws javax.jms.JMSException
#Description of the Method

Specified by:
remove in interface PersistenceManager
Parameters:
txId - Description of Parameter
messageRef - the message
Throws:
javax.jms.JMSException - Description of Exception

update

public void update(MessageReference messageRef,
                   Tx txId)
            throws javax.jms.JMSException
#Description of the Method

Specified by:
update in interface PersistenceManager
Parameters:
txId - Description of Parameter
messageRef -
Throws:
javax.jms.JMSException - Description of Exception

rollbackPersistentTx

public void rollbackPersistentTx(Tx txId)
                          throws javax.jms.JMSException
#Description of the Method

Specified by:
rollbackPersistentTx in interface PersistenceManager
Parameters:
txId - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

getTxInfo

protected org.jboss.mq.pm.file.PersistenceManager.TxInfo getTxInfo(File f)
                                                            throws javax.jms.JMSException
Throws:
javax.jms.JMSException

releaseTxInfo

protected void releaseTxInfo(org.jboss.mq.pm.file.PersistenceManager.TxInfo info)

testRollBackTx

protected boolean testRollBackTx(Long tx,
                                 ArrayList removingMessages)
                          throws IOException
Throws:
IOException

deleteTxFile

protected void deleteTxFile(File file)
                     throws javax.jms.JMSException
Throws:
javax.jms.JMSException

readTxFile

protected ArrayList readTxFile(File file)
                        throws javax.jms.JMSException
Throws:
javax.jms.JMSException

createTxFile

protected File createTxFile(Tx txId)
                     throws javax.jms.JMSException
Throws:
javax.jms.JMSException

closeQueue

public void closeQueue(JMSDestination jmsDest,
                       SpyDestination dest)
                throws javax.jms.JMSException
Description copied from interface: PersistenceManager
Close a queue

Specified by:
closeQueue in interface PersistenceManager
Parameters:
jmsDest - the jms destination
dest - the client destination
Throws:
javax.jms.JMSException - for any error

encodeFileName

public static String encodeFileName(String name)
Used to encode any string into a string that is safe to use as a file name on most operating systems.



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.