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

java.lang.Object
  extended by org.jboss.messaging.core.paging.impl.PagingStoreImpl
All Implemented Interfaces:
TestSupportPageStore, PagingStore, MessagingComponent

public class PagingStoreImpl
extends java.lang.Object
implements TestSupportPageStore

Author:
Clebert Suconic
See Also:
PagingStore

Constructor Summary
PagingStoreImpl(PagingManager pagingManager, StorageManager storageManager, PostOffice postOffice, SequentialFileFactory fileFactory, PagingStoreFactory storeFactory, SimpleString storeName, AddressSettings addressSettings, java.util.concurrent.Executor executor)
           
 
Method Summary
 void addSize(long size)
           
protected  Page createPage(int page)
           
 Page depage()
          It returns a Page out of the Page System without reading it.
 void forceAnotherPage()
           
 long getAddressSize()
           
 long getMaxSizeBytes()
          Maximum number of bytes allowed in memory
 int getNumberOfPages()
           
 long getPageSizeBytes()
           
 SimpleString getStoreName()
           
 boolean isDropWhenMaxSize()
           
 boolean isPaging()
           
 boolean isStarted()
           
 boolean page(PagedMessage message, boolean sync, boolean duplicateDetection)
           
 boolean readPage()
          Depage one page-file, read it and send it to the pagingManager / postoffice
 void start()
           
 boolean startDepaging()
           
 boolean startDepaging(java.util.concurrent.Executor executor)
          When start depaging from a global perspective, we don't want all the stores depaging at once what could saturate the servers
 boolean startPaging()
           
 void stop()
           
 void sync()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagingStoreImpl

public PagingStoreImpl(PagingManager pagingManager,
                       StorageManager storageManager,
                       PostOffice postOffice,
                       SequentialFileFactory fileFactory,
                       PagingStoreFactory storeFactory,
                       SimpleString storeName,
                       AddressSettings addressSettings,
                       java.util.concurrent.Executor executor)
Method Detail

getAddressSize

public long getAddressSize()
Specified by:
getAddressSize in interface PagingStore

getMaxSizeBytes

public long getMaxSizeBytes()
Maximum number of bytes allowed in memory

Specified by:
getMaxSizeBytes in interface PagingStore

isDropWhenMaxSize

public boolean isDropWhenMaxSize()
Specified by:
isDropWhenMaxSize in interface PagingStore

getPageSizeBytes

public long getPageSizeBytes()
Specified by:
getPageSizeBytes in interface PagingStore

isPaging

public boolean isPaging()
Specified by:
isPaging in interface PagingStore

getNumberOfPages

public int getNumberOfPages()
Specified by:
getNumberOfPages in interface PagingStore

getStoreName

public SimpleString getStoreName()
Specified by:
getStoreName in interface PagingStore

addSize

public void addSize(long size)
             throws java.lang.Exception
Specified by:
addSize in interface PagingStore
Throws:
java.lang.Exception

page

public boolean page(PagedMessage message,
                    boolean sync,
                    boolean duplicateDetection)
             throws java.lang.Exception
Specified by:
page in interface PagingStore
Throws:
java.lang.Exception

sync

public void sync()
          throws java.lang.Exception
Specified by:
sync in interface PagingStore
Throws:
java.lang.Exception

startDepaging

public boolean startDepaging()
Specified by:
startDepaging in interface PagingStore
Returns:
false if a thread was already started, or if not in page mode

startDepaging

public boolean startDepaging(java.util.concurrent.Executor executor)
Description copied from interface: PagingStore
When start depaging from a global perspective, we don't want all the stores depaging at once what could saturate the servers

Specified by:
startDepaging in interface PagingStore

isStarted

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

stop

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

start

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

startPaging

public boolean startPaging()
                    throws java.lang.Exception
Specified by:
startPaging in interface PagingStore
Returns:
true if paging was started, or false if paging was already started before this call
Throws:
java.lang.Exception

readPage

public boolean readPage()
                 throws java.lang.Exception
Depage one page-file, read it and send it to the pagingManager / postoffice

Specified by:
readPage in interface PagingStore
Returns:
Throws:
java.lang.Exception

forceAnotherPage

public void forceAnotherPage()
                      throws java.lang.Exception
Specified by:
forceAnotherPage in interface TestSupportPageStore
Throws:
java.lang.Exception

depage

public Page depage()
            throws java.lang.Exception
It returns a Page out of the Page System without reading it. The method calling this method will remove the page and will start reading it outside of any locks. This method could also replace the current file by a new file, and that process is done through acquiring a writeLock on currentPageLock Observation: This method is used internally as part of the regular depage process, but externally is used only on tests, and that's why this method is part of the Testable Interface

Specified by:
depage in interface TestSupportPageStore
Returns:
Throws:
java.lang.Exception - Note: This should still be part of the interface, even though JBossMessaging only uses through the

createPage

protected Page createPage(int page)
                   throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2006 JBoss Inc. All Rights Reserved.