org.jboss.messaging.core.paging.impl
Class PagingManagerImpl

java.lang.Object
  extended by org.jboss.messaging.core.paging.impl.PagingManagerImpl
All Implemented Interfaces:
PagingManager, MessagingComponent

public class PagingManagerImpl
extends java.lang.Object
implements PagingManager

Look at the WIKI for more information.

Author:
Clebert Suconic, Tim Fox,
Constructor Summary
PagingManagerImpl(PagingStoreFactory pagingSPI, StorageManager storageManager, HierarchicalRepository<AddressSettings> addressSettingsRepository, long maxGlobalSize, long globalPageSize, boolean syncNonTransactional, boolean backup)
           
 
Method Summary
 void activate()
           
 long addSize(long size)
           
 void addTransaction(PageTransactionInfo pageTransaction)
          Point to inform/restoring Transactions used when the messages were added into paging
 long getGlobalPageSize()
           
 long getMaxMemory()
           
 PagingStore getPageStore(SimpleString storeName)
          stores is a ConcurrentHashMap, so we don't need to synchronize this method
 long getTotalMemory()
           
 PageTransactionInfo getTransaction(long id)
          Point to inform/restoring Transactions used when the messages were added into paging
 boolean isBackup()
           
 boolean isGlobalPageMode()
          The system is paging because of global-page-mode
 boolean isPaging(SimpleString destination)
          To be used by transactions only.
 boolean isStarted()
           
 boolean page(ServerMessage message, boolean duplicateDetection)
          Page, only if destination is in page mode.
 boolean page(ServerMessage message, long transactionId, boolean duplicateDetection)
          Page, only if destination is in page mode.
 void reloadStores()
          Reload previously created PagingStores into memory
 void removeTransaction(long id)
           
 void setGlobalPageMode(boolean globalMode)
          During startup PostOffice may set GlobalPageMode as true
 void setPostOffice(PostOffice postOffice)
          this will be set by the postOffice itself.
 void start()
           
 void startGlobalDepage()
           
 void stop()
           
 void sync(java.util.Collection<SimpleString> destinationsToSync)
          Sync current-pages on disk for these destinations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagingManagerImpl

public PagingManagerImpl(PagingStoreFactory pagingSPI,
                         StorageManager storageManager,
                         HierarchicalRepository<AddressSettings> addressSettingsRepository,
                         long maxGlobalSize,
                         long globalPageSize,
                         boolean syncNonTransactional,
                         boolean backup)
Method Detail

activate

public void activate()
Specified by:
activate in interface PagingManager

isBackup

public boolean isBackup()
Specified by:
isBackup in interface PagingManager

isGlobalPageMode

public boolean isGlobalPageMode()
Description copied from interface: PagingManager
The system is paging because of global-page-mode

Specified by:
isGlobalPageMode in interface PagingManager

setGlobalPageMode

public void setGlobalPageMode(boolean globalMode)
Description copied from interface: PagingManager
During startup PostOffice may set GlobalPageMode as true

Specified by:
setGlobalPageMode in interface PagingManager

reloadStores

public void reloadStores()
                  throws java.lang.Exception
Description copied from interface: PagingManager
Reload previously created PagingStores into memory

Specified by:
reloadStores in interface PagingManager
Throws:
java.lang.Exception

getPageStore

public PagingStore getPageStore(SimpleString storeName)
                         throws java.lang.Exception
stores is a ConcurrentHashMap, so we don't need to synchronize this method

Specified by:
getPageStore in interface PagingManager
Throws:
java.lang.Exception

setPostOffice

public void setPostOffice(PostOffice postOffice)
this will be set by the postOffice itself. There is no way to set this on the constructor as the PagingManager is constructed before the postOffice. (There is a one-to-one relationship here)

Specified by:
setPostOffice in interface PagingManager

getGlobalPageSize

public long getGlobalPageSize()
Specified by:
getGlobalPageSize in interface PagingManager
Returns:

isPaging

public boolean isPaging(SimpleString destination)
                 throws java.lang.Exception
Description copied from interface: PagingManager
To be used by transactions only. If you're sure you will page if isPaging, just call the method page and look at its return.

Specified by:
isPaging in interface PagingManager
Returns:
Throws:
java.lang.Exception

page

public boolean page(ServerMessage message,
                    long transactionId,
                    boolean duplicateDetection)
             throws java.lang.Exception
Description copied from interface: PagingManager
Page, only if destination is in page mode.

Specified by:
page in interface PagingManager
Returns:
false if destination is not on page mode
Throws:
java.lang.Exception

page

public boolean page(ServerMessage message,
                    boolean duplicateDetection)
             throws java.lang.Exception
Description copied from interface: PagingManager
Page, only if destination is in page mode.

Specified by:
page in interface PagingManager
Returns:
false if destination is not on page mode
Throws:
java.lang.Exception

addTransaction

public void addTransaction(PageTransactionInfo pageTransaction)
Description copied from interface: PagingManager
Point to inform/restoring Transactions used when the messages were added into paging

Specified by:
addTransaction in interface PagingManager

removeTransaction

public void removeTransaction(long id)
Specified by:
removeTransaction in interface PagingManager

getTransaction

public PageTransactionInfo getTransaction(long id)
Description copied from interface: PagingManager
Point to inform/restoring Transactions used when the messages were added into paging

Specified by:
getTransaction in interface PagingManager

sync

public void sync(java.util.Collection<SimpleString> destinationsToSync)
          throws java.lang.Exception
Description copied from interface: PagingManager
Sync current-pages on disk for these destinations

Specified by:
sync in interface PagingManager
Throws:
java.lang.Exception

isStarted

public boolean isStarted()
Specified by:
isStarted in interface MessagingComponent

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface MessagingComponent
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface MessagingComponent
Throws:
java.lang.Exception

startGlobalDepage

public void startGlobalDepage()
Specified by:
startGlobalDepage in interface PagingManager

getTotalMemory

public long getTotalMemory()
Specified by:
getTotalMemory in interface PagingManager
Returns:

addSize

public long addSize(long size)
Specified by:
addSize in interface PagingManager
Returns:

getMaxMemory

public long getMaxMemory()
Specified by:
getMaxMemory in interface PagingManager
Returns:


Copyright © 2006 JBoss Inc. All Rights Reserved.