public class PagingStoreImpl extends Object implements PagingStore
PagingStore
Constructor and Description |
---|
PagingStoreImpl(SimpleString address,
ScheduledExecutorService scheduledExecutor,
long syncTimeout,
PagingManager pagingManager,
StorageManager storageManager,
SequentialFileFactory fileFactory,
PagingStoreFactory storeFactory,
SimpleString storeName,
AddressSettings addressSettings,
Executor executor,
boolean syncNonTransactional) |
Modifier and Type | Method and Description |
---|---|
void |
addSize(int size) |
void |
applySetting(AddressSettings addressSettings) |
boolean |
checkMemory(Runnable runWhenAvailable) |
boolean |
checkPageFileExists(int pageNumber) |
Page |
createPage(int pageNumber) |
Page |
depage()
Returns a Page out of the Page System without reading it.
|
void |
disableCleanup()
This method will disable cleanup of pages.
|
void |
enableCleanup()
This method will re-enable cleanup of pages.
|
void |
flushExecutors()
This is used mostly by tests.
|
void |
forceAnotherPage() |
SimpleString |
getAddress() |
AddressFullMessagePolicy |
getAddressFullMessagePolicy() |
long |
getAddressSize() |
Collection<Integer> |
getCurrentIds()
Files to synchronize with a remote backup.
|
Page |
getCurrentPage() |
int |
getCurrentWritingPage()
Returns the page id of the current page in which the system is writing files.
|
PageCursorProvider |
getCursorProvider() |
long |
getFirstPage() |
String |
getFolder() |
long |
getMaxSize() |
int |
getNumberOfPages() |
long |
getPageSizeBytes() |
PagingManager |
getPagingManager() |
SimpleString |
getStoreName() |
void |
ioSync()
Performs a real sync on the current IO file.
|
boolean |
isPaging() |
boolean |
isStarted() |
boolean |
lock(long timeout)
Write lock the PagingStore.
|
boolean |
page(ServerMessage message,
Transaction tx,
RouteContextList listCtx,
ReentrantReadWriteLock.ReadLock managerLock)
Write message to page if we are paging.
|
void |
processReload() |
void |
sendPages(ReplicationManager replicator,
Collection<Integer> pageIds)
Sends the pages with given IDs to the
ReplicationManager . |
void |
start() |
boolean |
startPaging() |
void |
stop() |
void |
stopPaging() |
void |
sync()
Schedules sync to the file storage.
|
String |
toString() |
void |
unlock()
Releases locks acquired with
PagingStore.lock(long) . |
public PagingStoreImpl(SimpleString address, ScheduledExecutorService scheduledExecutor, long syncTimeout, PagingManager pagingManager, StorageManager storageManager, SequentialFileFactory fileFactory, PagingStoreFactory storeFactory, SimpleString storeName, AddressSettings addressSettings, Executor executor, boolean syncNonTransactional)
public void applySetting(AddressSettings addressSettings)
applySetting
in interface PagingStore
addressSettings
- public boolean lock(long timeout)
PagingStore
lock
in interface PagingStore
timeout
- milliseconds to wait for the lock. If value is -1 then wait
indefinitely.true
if the lock was obtained, false
otherwisepublic void unlock()
PagingStore
PagingStore.lock(long)
.unlock
in interface PagingStore
public PageCursorProvider getCursorProvider()
getCursorProvider
in interface PagingStore
public long getFirstPage()
getFirstPage
in interface PagingStore
public SimpleString getAddress()
getAddress
in interface PagingStore
public long getAddressSize()
getAddressSize
in interface PagingStore
public long getMaxSize()
getMaxSize
in interface PagingStore
public AddressFullMessagePolicy getAddressFullMessagePolicy()
getAddressFullMessagePolicy
in interface PagingStore
public long getPageSizeBytes()
getPageSizeBytes
in interface PagingStore
public String getFolder()
getFolder
in interface PagingStore
public boolean isPaging()
isPaging
in interface PagingStore
public int getNumberOfPages()
getNumberOfPages
in interface PagingStore
public int getCurrentWritingPage()
PagingStore
getCurrentWritingPage
in interface PagingStore
public SimpleString getStoreName()
getStoreName
in interface PagingStore
public void sync() throws Exception
PagingStore
sync
in interface PagingStore
Exception
public void ioSync() throws Exception
PagingStore
ioSync
in interface PagingStore
Exception
public void processReload() throws Exception
processReload
in interface PagingStore
Exception
public PagingManager getPagingManager()
getPagingManager
in interface PagingStore
public boolean isStarted()
isStarted
in interface HornetQComponent
public void stop() throws Exception
stop
in interface HornetQComponent
Exception
public void flushExecutors()
PagingStore
flushExecutors
in interface PagingStore
public void start() throws Exception
start
in interface HornetQComponent
Exception
public void stopPaging()
stopPaging
in interface PagingStore
public boolean startPaging()
startPaging
in interface PagingStore
public Page getCurrentPage()
getCurrentPage
in interface PagingStore
public boolean checkPageFileExists(int pageNumber)
checkPageFileExists
in interface PagingStore
public Page createPage(int pageNumber) throws Exception
createPage
in interface PagingStore
Exception
public void forceAnotherPage() throws Exception
forceAnotherPage
in interface PagingStore
Exception
public Page depage() throws Exception
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
depage
in interface PagingStore
Exception
- Note: This should still be part of the interface, even though HornetQ only uses through thepublic boolean checkMemory(Runnable runWhenAvailable)
checkMemory
in interface PagingStore
public void addSize(int size)
addSize
in interface PagingStore
public boolean page(ServerMessage message, Transaction tx, RouteContextList listCtx, ReentrantReadWriteLock.ReadLock managerLock) throws Exception
PagingStore
page
in interface PagingStore
managerLock
- a read lock from the storage manager. This is an encapsulation violation made
to keep the code less complex. If give null
the method will throw a
NullPointerException
true
if we are paging and have handled the data, false
if the data
needs to be sent to the journalNullPointerException
- if readLock
is nullException
public void disableCleanup()
disableCleanup
in interface PagingStore
public void enableCleanup()
enableCleanup
in interface PagingStore
public Collection<Integer> getCurrentIds() throws Exception
PagingStore
getCurrentIds
in interface PagingStore
Exception
public void sendPages(ReplicationManager replicator, Collection<Integer> pageIds) throws Exception
PagingStore
ReplicationManager
.
Sending is done here to avoid exposing the internal SequentialFile
s.sendPages
in interface PagingStore
Exception
Copyright © 2018 JBoss by Red Hat. All rights reserved.