Java Doc for FileLogger.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » raw » log » 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.log 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.store.raw.log.FileLogger

FileLogger
public class FileLogger implements Logger(Code)
Write log records to a log file as a stream (ie. log records added to the end of the file, no concept of pages).

The format of a log record that is not a compensation operation is


See Also:   LogRecord


Field Summary
protected  byte[]encryptionBuffer
    

Constructor Summary
public  FileLogger(LogToFile logFactory)
    

Method Summary
public  voidclose()
     Close the logger.
public  voidflush(LogInstant where)
     Flush the log up to the given log instant.
public  voidflushAll()
     Flush all outstanding log to disk.
public synchronized  LogInstantlogAndDo(RawTransaction xact, Loggable operation)
     Writes out a log record to the log stream, and call its doMe method to apply the change to the rawStore.
Any optional data the doMe method need is first written to the log stream using operation.writeOptionalData, then whatever is written to the log stream is passed back to the operation for the doMe method.

MT - there could be multiple threads running in the same raw transactions and they can be calling the same logger to log different log operations.

public  LogInstantlogAndUndo(RawTransaction xact, Compensation compensation, LogInstant undoInstant, LimitObjectInput in)
     Writes out a compensation log record to the log stream, and call its doMe method to undo the change of a previous log operation.

MT - Not needed.

protected  LoggablereadLogRecord(StreamLogScan scan, int size)
     Read the next log record from the scan.

MT - caller must provide synchronization (right now, it is only called in recovery to find the checkpoint log record.

protected  longredo(RawTransaction recoveryTransaction, TransactionFactory transFactory, StreamLogScan redoScan, long redoLWM, long ttabInstant)
     Recovery Redo loop.

The log stream is scanned from the beginning (or from the undo low water mark of a checkpoint) forward until the end. The purpose of the redo pass is to repeat history, i.e, to repeat exactly the same set of changes the rawStore went thru right before it stopped.

public  voidreprepare(RawTransaction t, TransactionId prepareId, LogInstant prepareStopAt, LogInstant prepareStartAt)
     During recovery re-prepare a transaction.

After redo() and undo(), this routine is called on all outstanding in-doubt (prepared) transactions.

public  voidundo(RawTransaction t, TransactionId undoId, LogInstant undoStopAt, LogInstant undoStartAt)
     Undo a part of or the entire transaction.

Field Detail
encryptionBuffer
protected byte[] encryptionBuffer(Code)




Constructor Detail
FileLogger
public FileLogger(LogToFile logFactory)(Code)
Make a new Logger with its own log record buffers MT - not needed for constructor




Method Detail
close
public void close() throws IOException(Code)
Close the logger. MT - caller provide synchronization (RESOLVE: not called by anyone ??)



flush
public void flush(LogInstant where) throws StandardException(Code)
Flush the log up to the given log instant.

MT - not needed, wrapper method
exception:
  StandardException - cannot sync log file




flushAll
public void flushAll() throws StandardException(Code)
Flush all outstanding log to disk.

MT - not needed, wrapper method
exception:
  StandardException - cannot sync log file




logAndDo
public synchronized LogInstant logAndDo(RawTransaction xact, Loggable operation) throws StandardException(Code)
Writes out a log record to the log stream, and call its doMe method to apply the change to the rawStore.
Any optional data the doMe method need is first written to the log stream using operation.writeOptionalData, then whatever is written to the log stream is passed back to the operation for the doMe method.

MT - there could be multiple threads running in the same raw transactions and they can be calling the same logger to log different log operations. This whole method is synchronized to make sure log records are logged one at a time.
Parameters:
  xact - the transaction logging the change
Parameters:
  operation - the log operation the instant in the log that can be used to identify the logrecord
exception:
  StandardException - Cloudscape Standard error policy




logAndUndo
public LogInstant logAndUndo(RawTransaction xact, Compensation compensation, LogInstant undoInstant, LimitObjectInput in) throws StandardException(Code)
Writes out a compensation log record to the log stream, and call its doMe method to undo the change of a previous log operation.

MT - Not needed. A transaction must be single threaded thru undo, each RawTransaction has its own logger, therefore no need to synchronize. The RawTransaction must handle synchronizing with multiple threads during rollback.
Parameters:
  xact - the transaction logging the change
Parameters:
  compensation - the compensation log operation
Parameters:
  undoInstant - the log instant of the operation that is to berolled back
Parameters:
  in - optional data input for the compenastion doMe method the instant in the log that can be used to identify the logrecord
exception:
  StandardException - Cloudscape Standard error policy




readLogRecord
protected Loggable readLogRecord(StreamLogScan scan, int size) throws IOException, StandardException, ClassNotFoundException(Code)
Read the next log record from the scan.

MT - caller must provide synchronization (right now, it is only called in recovery to find the checkpoint log record. When this method is called by a more general audience, MT must be revisited).
Parameters:
  scan - an opened log scan
Parameters:
  size - estimated size of the log record the log operation that is the next in the scan, or null if nomore log operation in the log scan
exception:
  IOException - Error reading the log file
exception:
  StandardException - Standard Cloudscape error policy
exception:
  ClassNotFoundException - log corrupted




redo
protected long redo(RawTransaction recoveryTransaction, TransactionFactory transFactory, StreamLogScan redoScan, long redoLWM, long ttabInstant) throws IOException, StandardException, ClassNotFoundException(Code)
Recovery Redo loop.

The log stream is scanned from the beginning (or from the undo low water mark of a checkpoint) forward until the end. The purpose of the redo pass is to repeat history, i.e, to repeat exactly the same set of changes the rawStore went thru right before it stopped. With each log record that is encountered in the redo pass:

  1. if it isFirst(), then the transaction factory is called upon to create a new transaction object.
  2. if it needsRedo(), its doMe() is called (if it is a compensation operation, then the undoable operation needs to be created first before the doMe is called).
  3. if it isComplete(), then the transaction object is closed.

MT - caller provides synchronization
Parameters:
  transFactory - - the transaction factory
Parameters:
  redoLWM - - if checkpoint seen, starting from this pointon, apply redo if necessary the log instant of the next log record (or the instant justafter the last log record). This is used to determine where the logtruly ends
exception:
  StandardException - Standard Cloudscape error policy
exception:
  IOException - error reading log file
exception:
  ClassNotFoundException - log file corrupted
See Also:   LogToFile.recover




reprepare
public void reprepare(RawTransaction t, TransactionId prepareId, LogInstant prepareStopAt, LogInstant prepareStartAt) throws StandardException(Code)
During recovery re-prepare a transaction.

After redo() and undo(), this routine is called on all outstanding in-doubt (prepared) transactions. This routine re-acquires all logical write locks for operations in the xact, and then modifies the transaction table entry to make the transaction look as if it had just been prepared following startup after recovery.


Parameters:
  t - is the transaction performing the re-prepare
Parameters:
  prepareId - is the transaction ID to be re-prepared
Parameters:
  prepareStopAt - is where the log instant (inclusive) where the re-prepare should stop.
Parameters:
  prepareStartAt - is the log instant (inclusive) where re-prepare should begin, this is normally the log instant of the last log record of the transaction that is to be re-prepare. If null, then re-prepare starts from the end of the log.
exception:
  StandardException - Standard exception policy.




undo
public void undo(RawTransaction t, TransactionId undoId, LogInstant undoStopAt, LogInstant undoStartAt) throws StandardException(Code)
Undo a part of or the entire transaction. Begin rolling back the log record at undoStartAt and stopping at (inclusive) the log record at undoStopAt.

MT - Not needed. A transaction must be single threaded thru undo, each RawTransaction has its own logger, therefore no need to synchronize. The RawTransaction must handle synchronizing with multiple threads during rollback.
Parameters:
  t - the transaction that needs to be rolled back
Parameters:
  undoId - the transaction ID
Parameters:
  undoStopAt - the last log record that should be rolled back
Parameters:
  undoStartAt - the first log record that should be rolled back
exception:
  StandardException - Standard Cloudscape error policy
See Also:   Logger.undo




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)

w_w_w___.___j__a__va_2_s___._c_om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.