Java Doc for CachedPage.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » raw » data » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.store.raw.data 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.store.raw.data.BasePage
      org.apache.derby.impl.store.raw.data.CachedPage

All known Subclasses:   org.apache.derby.impl.store.raw.data.StoredPage,
CachedPage
abstract public class CachedPage extends BasePage implements Cacheable(Code)
A base page that is cached. Since there are multiple page formats, use this abstract class to implement cacheable interface.


Field Summary
final protected static  intPAGE_FORMAT_ID_SIZE
    
final public static  intWRITE_NO_SYNC
    
final public static  intWRITE_SYNC
    
protected  booleanalreadyReadPage
    
protected  CacheManagercontainerCache
     The container cache my container lives in.
protected  BaseDataFileFactorydataFactory
     My factory class.
protected  intinitialRowCount
    
protected  booleanisDirty
    
protected  CacheManagerpageCache
     The page cache I live in.
protected  byte[]pageData
    
protected  booleanpreDirty
    

Constructor Summary
public  CachedPage()
    

Method Summary
public  voidclean(boolean remove)
     Write the page to disk.

MP - In a simple world we would just not allow clean until it held the latch on the page.

public  voidclearIdentity()
    
public  CacheablecreateIdentity(Object key, Object createParameter)
     Find the container and then create the page in that container.
abstract protected  voidcreatePage(PageKey id, int[] args)
    
protected  byte[]getPageArray()
     Returns the page data array used to write on disk version.

returns the page data array, that is actually written to the disk, when the page is cleaned from the page cache.

abstract protected  voidinitFromData(FileContainer container, PageKey id)
    
protected  voidinitialize()
     Initialize a CachedPage.

Initialize the object, ie.

public  booleanisActuallyDirty()
     Has the page or its header been modified.
public  booleanisDirty()
     Is the page dirty?

The isDirty flag indicates if the pageData or pageHeader has been modified.

public  voidpreDirty()
     Set state to indicate the page or its header is about to be modified.
protected  voidreleaseExclusive()
     exclusive latch on page is being released.
public  voidsetContainerRowCount(long rowCount)
    
protected  voidsetDirty()
     Set state to indicate the page or its header has been modified.
final public  voidsetFactory(BaseDataFileFactory factory)
    
public  CacheablesetIdentity(Object key)
     Find the container and then read the page from that container.
protected  voidsetPageArray(int pageSize)
    
abstract protected  voidusePageBuffer(byte[] buffer)
    
abstract protected  voidwriteFormatId(PageKey identity)
    
abstract protected  voidwritePage(PageKey id)
    

Field Detail
PAGE_FORMAT_ID_SIZE
final protected static int PAGE_FORMAT_ID_SIZE(Code)



WRITE_NO_SYNC
final public static int WRITE_NO_SYNC(Code)



WRITE_SYNC
final public static int WRITE_SYNC(Code)



alreadyReadPage
protected boolean alreadyReadPage(Code)



containerCache
protected CacheManager containerCache(Code)
The container cache my container lives in.
MT - Immutable



dataFactory
protected BaseDataFileFactory dataFactory(Code)
My factory class.
MT - Immutable -



initialRowCount
protected int initialRowCount(Code)



isDirty
protected boolean isDirty(Code)



pageCache
protected CacheManager pageCache(Code)
The page cache I live in.
MT - Immutable



pageData
protected byte[] pageData(Code)



preDirty
protected boolean preDirty(Code)




Constructor Detail
CachedPage
public CachedPage()(Code)




Method Detail
clean
public void clean(boolean remove) throws StandardException(Code)
Write the page to disk.

MP - In a simple world we would just not allow clean until it held the latch on the page. But in order to fit into the cache system, we don't have enough state around to just make clean() latch the page while doing the I/O - but we still need someway to insure that no changes happen to the page while the I/O is taking place. Also someday it would be fine to allow reads of this page while the I/O was taking place.
exception:
  StandardException - Error writing the page.
See Also:   Cacheable.clean




clearIdentity
public void clearIdentity()(Code)



createIdentity
public Cacheable createIdentity(Object key, Object createParameter) throws StandardException(Code)
Find the container and then create the page in that container.

This is the process of creating a new page in a container, in that case no need to read the page from disk - just need to initialize it in the cache.

new page, higher levels have already checked the page number is valid for an open.
Parameters:
  key - Which page is this?
Parameters:
  createParameter - details needed to create page like size, format id, ...
exception:
  StandardException - Standard exception policy.
See Also:   Cacheable.createIdentity




createPage
abstract protected void createPage(PageKey id, int[] args) throws StandardException(Code)



getPageArray
protected byte[] getPageArray() throws StandardException(Code)
Returns the page data array used to write on disk version.

returns the page data array, that is actually written to the disk, when the page is cleaned from the page cache. Takes care of flushing in-memory information to the array (like page header and format id info).

The array of bytes that is the on disk version of page.
exception:
  StandardException - Standard exception policy.




initFromData
abstract protected void initFromData(FileContainer container, PageKey id) throws StandardException(Code)



initialize
protected void initialize()(Code)
Initialize a CachedPage.

Initialize the object, ie. perform work normally perfomed in constructor. Called by setIdentity() and createIdentity().




isActuallyDirty
public boolean isActuallyDirty()(Code)
Has the page or its header been modified.

See comment on class header on meaning of isDirty and preDirty bits.

true if changes have actually been made to the page in memory.




isDirty
public boolean isDirty()(Code)
Is the page dirty?

The isDirty flag indicates if the pageData or pageHeader has been modified. The preDirty flag indicates that the pageData or the pageHeader is about to be modified. The reason for these 2 flags instead of just one is to accomodate checkpoint. After a clean (latched) page sends a log record to the log stream but before that page is dirtied by the log operation, a checkpoint could be taken. If so, then the redoLWM will be after the log record but, without preDirty, the cache cleaning will not have waited for the change. So the preDirty bit is to stop the cache cleaning from skipping over this (latched) page even though it has not really been modified yet. true if the page is dirty.
See Also:   Cacheable.isDirty




preDirty
public void preDirty()(Code)
Set state to indicate the page or its header is about to be modified.

See comment on class header on meaning of isDirty and preDirty bits.




releaseExclusive
protected void releaseExclusive()(Code)
exclusive latch on page is being released.

The only work done in CachedPage is to update the row count on the container if it is too out of sync.




setContainerRowCount
public void setContainerRowCount(long rowCount)(Code)



setDirty
protected void setDirty()(Code)
Set state to indicate the page or its header has been modified.

See comment on class header on meaning of isDirty and preDirty bits.




setFactory
final public void setFactory(BaseDataFileFactory factory)(Code)



setIdentity
public Cacheable setIdentity(Object key) throws StandardException(Code)
Find the container and then read the page from that container.

This is the way new pages enter the page cache.

always true, higher levels have already checked the page number is valid for an open.
exception:
  StandardException - Standard Cloudscape policy.
See Also:   Cacheable.setIdentity




setPageArray
protected void setPageArray(int pageSize) throws StandardException(Code)



usePageBuffer
abstract protected void usePageBuffer(byte[] buffer)(Code)



writeFormatId
abstract protected void writeFormatId(PageKey identity) throws StandardException(Code)



writePage
abstract protected void writePage(PageKey id) throws StandardException(Code)



Fields inherited from org.apache.derby.impl.store.raw.data.BasePage
final public static int INIT_PAGE_OVERFLOW(Code)(Java Doc)
final public static int INIT_PAGE_REUSE(Code)(Java Doc)
final public static int INIT_PAGE_REUSE_RECORDID(Code)(Java Doc)
final public static byte INVALID_PAGE(Code)(Java Doc)
final public static int LOG_RECORD_DEFAULT(Code)(Java Doc)
final public static int LOG_RECORD_FOR_PURGE(Code)(Java Doc)
final public static int LOG_RECORD_FOR_UPDATE(Code)(Java Doc)
final public static byte VALID_PAGE(Code)(Java Doc)
protected PageKey identity(Code)(Java Doc)
protected boolean inClean(Code)(Java Doc)
protected BaseContainerHandle owner(Code)(Java Doc)
protected boolean preLatch(Code)(Java Doc)

Methods inherited from org.apache.derby.impl.store.raw.data.BasePage
final public static RecordHandle MakeRecordHandle(PageKey pkey, int recordHandleConstant) throws StandardException(Code)(Java Doc)
abstract public boolean allowInsert()(Code)(Java Doc)
abstract public int appendOverflowFieldHeader(DynamicByteArrayOutputStream logBuffer, RecordHandle overflowHandle) throws StandardException, IOException(Code)(Java Doc)
final protected long bumpPageVersion()(Code)(Java Doc)
final protected void bumpRecordCount(int number)(Code)(Java Doc)
protected void cleanPageForReuse()(Code)(Java Doc)
public void clearIdentity()(Code)(Java Doc)
final protected void clearLastLogInstant()(Code)(Java Doc)
public void compactRecord(RecordHandle handle) throws StandardException(Code)(Java Doc)
abstract protected void compactRecord(RawTransaction t, int slot, int recordId) throws StandardException(Code)(Java Doc)
public void copyAndPurge(Page destPage, int src_slot, int num_rows, int dest_slot) throws StandardException(Code)(Java Doc)
public void deallocatePage() throws StandardException(Code)(Java Doc)
public boolean delete(RecordHandle handle, LogicalUndo undo) throws StandardException(Code)(Java Doc)
public RecordHandle deleteAtSlot(int slot, boolean delete, LogicalUndo undo) throws StandardException(Code)(Java Doc)
abstract public void doUpdateAtSlot(RawTransaction t, int slot, int id, Object[] row, FormatableBitSet validColumns) throws StandardException(Code)(Java Doc)
abstract public boolean entireRecordOnPage(int slot) throws StandardException(Code)(Java Doc)
public RecordHandle fetch(RecordHandle handle, Object[] row, FormatableBitSet validColumns, boolean forUpdate) throws StandardException(Code)(Java Doc)
final public RecordHandle fetchFieldFromSlot(int slot, int fieldId, Object column) throws StandardException(Code)(Java Doc)
public RecordHandle fetchFromSlot(RecordHandle rh, int slot, Object[] row, FetchDescriptor fetchDesc, boolean ignoreDelete) throws StandardException(Code)(Java Doc)
final public int fetchNumFields(RecordHandle handle) throws StandardException(Code)(Java Doc)
public int fetchNumFieldsAtSlot(int slot) throws StandardException(Code)(Java Doc)
protected void fillInIdentity(PageKey key)(Code)(Java Doc)
public int findRecordById(int recordId, int slotHint)(Code)(Java Doc)
public AuxObject getAuxObject()(Code)(Java Doc)
final public StoredRecordHeader getHeaderAtSlot(int slot)(Code)(Java Doc)
public Object getIdentity()(Code)(Java Doc)
final public RecordHandle getInvalidRecordHandle()(Code)(Java Doc)
final public LogInstant getLastLogInstant()(Code)(Java Doc)
abstract protected BasePage getNewOverflowPage() throws StandardException(Code)(Java Doc)
final public int getNextSlotNumber(RecordHandle handle) throws StandardException(Code)(Java Doc)
abstract public BasePage getOverflowPageForInsert(int slot, Object[] row, FormatableBitSet validColumns, int startColumn) throws StandardException(Code)(Java Doc)
abstract protected byte[] getPageArray() throws StandardException(Code)(Java Doc)
public PageKey getPageId()(Code)(Java Doc)
final public long getPageNumber()(Code)(Java Doc)
public byte getPageStatus()(Code)(Java Doc)
final public long getPageVersion()(Code)(Java Doc)
final public RecordHandle getRecordHandle(int recordId)(Code)(Java Doc)
final public RecordHandle getRecordHandleAtSlot(int slot)(Code)(Java Doc)
abstract public int getRecordLength(int slot) throws IOException(Code)(Java Doc)
abstract public int getReservedCount(int slot) throws IOException(Code)(Java Doc)
final public int getSlotNumber(RecordHandle handle) throws StandardException(Code)(Java Doc)
abstract public int getTotalSpace(int slot) throws StandardException(Code)(Java Doc)
public void initPage(int initFlag, long pageOffset) throws StandardException(Code)(Java Doc)
abstract public void initPage(LogInstant instant, byte status, int recordId, boolean overflow, boolean reuse) throws StandardException(Code)(Java Doc)
protected void initialize()(Code)(Java Doc)
protected void initializeHeaders(int numRecords)(Code)(Java Doc)
final public RecordHandle insert(Object[] row, FormatableBitSet validColumns, byte insertFlag, int overflowThreshold) throws StandardException(Code)(Java Doc)
public RecordHandle insertAllowOverflow(int slot, Object[] row, FormatableBitSet validColumns, int startColumn, byte insertFlag, int overflowThreshold, RecordHandle nextPortionHandle) throws StandardException(Code)(Java Doc)
public RecordHandle insertAtSlot(int slot, Object[] row, FormatableBitSet validColumns, LogicalUndo undo, byte insertFlag, int overflowThreshold) throws StandardException(Code)(Java Doc)
protected RecordHandle insertLongColumn(BasePage mainChainPage, LongColumnException lce, byte insertFlag) throws StandardException(Code)(Java Doc)
protected RecordHandle insertNoOverflow(int slot, Object[] row, FormatableBitSet validColumns, LogicalUndo undo, byte insertFlag, int overflowThreshold) throws StandardException(Code)(Java Doc)
abstract protected int internalDeletedRecordCount()(Code)(Java Doc)
protected int internalNonDeletedRecordCount()(Code)(Java Doc)
public boolean isDeletedAtSlot(int slot) throws StandardException(Code)(Java Doc)
final protected boolean isDeletedOnPage(int slot)(Code)(Java Doc)
public boolean isLatched()(Code)(Java Doc)
abstract public boolean isOverflowPage()(Code)(Java Doc)
public boolean lockAttributes(int flag, Hashtable attributes)(Code)(Java Doc)
public void lockEvent(Latch lockInfo)(Code)(Java Doc)
public boolean lockerAlwaysCompatible()(Code)(Java Doc)
abstract public void logColumn(int slot, int fieldId, Object column, DynamicByteArrayOutputStream out, int overflowThreshold) throws StandardException, IOException(Code)(Java Doc)
abstract public void logField(int slot, int fieldNumber, OutputStream out) throws StandardException, IOException(Code)(Java Doc)
abstract public int logLongColumn(int slot, int recordId, Object column, DynamicByteArrayOutputStream out) throws StandardException, IOException(Code)(Java Doc)
abstract public void logRecord(int slot, int flag, int recordId, FormatableBitSet validColumns, OutputStream out, RecordHandle headRowHandle) throws StandardException, IOException(Code)(Java Doc)
abstract public int logRow(int slot, boolean forInsert, int recordId, Object[] row, FormatableBitSet validColumns, DynamicByteArrayOutputStream out, int startColumn, byte insertFlag, int realStartColumn, int realSpaceOnPage, int overflowThreshold) throws StandardException, IOException(Code)(Java Doc)
final public RecordHandle makeRecordHandle(int recordHandleConstant) throws StandardException(Code)(Java Doc)
abstract public int newRecordId() throws StandardException(Code)(Java Doc)
abstract protected int newRecordId(int recordId) throws StandardException(Code)(Java Doc)
abstract public int newRecordIdAndBump() throws StandardException(Code)(Java Doc)
public int nonDeletedRecordCount()(Code)(Java Doc)
abstract public void preDirty()(Code)(Java Doc)
public void purgeAtSlot(int slot, int numpurges, boolean needDataLogged) throws StandardException(Code)(Java Doc)
abstract public void purgeRecord(LogInstant instant, int slot, int recordId) throws StandardException, IOException(Code)(Java Doc)
abstract protected void purgeRowPieces(RawTransaction t, int slot, RecordHandle headRowHandle, boolean needDataLogged) throws StandardException(Code)(Java Doc)
final public int recordCount()(Code)(Java Doc)
final public boolean recordExists(RecordHandle handle, boolean ignoreDelete) throws StandardException(Code)(Java Doc)
abstract public StoredRecordHeader recordHeaderOnDemand(int slot)(Code)(Java Doc)
protected void releaseExclusive()(Code)(Java Doc)
protected void removeAndShiftDown(int slot)(Code)(Java Doc)
public boolean requestCompatible(Object requestedQualifier, Object grantedQualifier)(Code)(Java Doc)
abstract public void reserveSpaceForSlot(LogInstant instant, int slot, int spaceToReserve) throws StandardException, IOException(Code)(Java Doc)
abstract protected void restorePortionLongColumn(OverflowInputStream fetchStream) throws StandardException, IOException(Code)(Java Doc)
abstract protected boolean restoreRecordFromSlot(int slot, Object[] row, FetchDescriptor fetchDesc, RecordHandle rh, StoredRecordHeader recordHeader, boolean isHeadRow) throws StandardException(Code)(Java Doc)
abstract public void restoreRecordFromStream(LimitObjectInput in, Object[] row) throws StandardException, IOException(Code)(Java Doc)
public void setAuxObject(AuxObject obj)(Code)(Java Doc)
abstract public void setContainerRowCount(long count)(Code)(Java Doc)
public int setDeleteStatus(int slot, boolean delete) throws StandardException, IOException(Code)(Java Doc)
abstract public void setDeleteStatus(LogInstant instant, int slot, boolean delete) throws StandardException, IOException(Code)(Java Doc)
public void setExclusive(BaseContainerHandle requester) throws StandardException(Code)(Java Doc)
boolean setExclusiveNoWait(BaseContainerHandle requester) throws StandardException(Code)(Java Doc)
final protected void setHeaderAtSlot(int slot, StoredRecordHeader rh)(Code)(Java Doc)
protected void setPageStatus(byte status)(Code)(Java Doc)
abstract public void setPageStatus(LogInstant instant, byte status) throws StandardException(Code)(Java Doc)
final public void setPageVersion(long v)(Code)(Java Doc)
abstract public void setReservedSpace(LogInstant instant, int slot, int value) throws StandardException, IOException(Code)(Java Doc)
protected StoredRecordHeader shiftUp(int low)(Code)(Java Doc)
public boolean shouldReclaimSpace(int num_non_deleted_rows, int slot_just_deleted) throws StandardException(Code)(Java Doc)
abstract public void skipField(ObjectInput in) throws StandardException, IOException(Code)(Java Doc)
abstract public void skipRecord(ObjectInput in) throws StandardException, IOException(Code)(Java Doc)
protected String slotTableToString()(Code)(Java Doc)
abstract public boolean spaceForCopy(int num_rows, int[] spaceNeeded) throws StandardException(Code)(Java Doc)
abstract public void storeField(LogInstant instant, int slot, int fieldId, ObjectInput in) throws StandardException, IOException(Code)(Java Doc)
abstract public void storeRecord(LogInstant instant, int slot, boolean forInsert, ObjectInput in) throws StandardException, IOException(Code)(Java Doc)
abstract public boolean unfilled()(Code)(Java Doc)
public void unlatch()(Code)(Java Doc)
public void unlockEvent(Latch lockInfo)(Code)(Java Doc)
final public boolean update(RecordHandle handle, Object[] row, FormatableBitSet validColumns) throws StandardException(Code)(Java Doc)
public void update(Observable obj, Object arg)(Code)(Java Doc)
final public RecordHandle updateAtSlot(int slot, Object[] row, FormatableBitSet validColumns) throws StandardException(Code)(Java Doc)
public RecordHandle updateFieldAtSlot(int slot, int fieldId, Object newValue, LogicalUndo undo) throws StandardException(Code)(Java Doc)
abstract public void updateFieldOverflowDetails(RecordHandle handle, RecordHandle overflowHandle) throws StandardException(Code)(Java Doc)
final protected void updateLastLogInstant(LogInstant instant)(Code)(Java Doc)
abstract public void updateOverflowDetails(RecordHandle handle, RecordHandle overflowHandle) throws StandardException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www_.j___a__va_2_s_.___c__o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.