Java Doc for Logger.java in  » Database-DBMS » hsql » org » hsqldb » persist » 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 » hsql » org.hsqldb.persist 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.hsqldb.persist.Logger

Logger
public class Logger (Code)
The public interface of logging and cache classes.

Implements a storage manager wrapper that provides a consistent, always available interface to storage management for the Database class, despite the fact not all Database objects actually use file storage.

The Logger class makes it possible to avoid testing for a null Log Database attribute again and again, in many different places, and generally avoids tight coupling between Database and Log, opening the doors for multiple logs/caches in the future. In this way, the Database class does not need to know the details of the Logging/Cache implementation, lowering its breakability factor and promoting long-term code flexibility.
author:
   fredt@users
version:
   1.8.0
since:
   1.7.0



Field Summary
public  SimpleLogappLog
    
 booleanneedsCheckpoint
    

Constructor Summary
public  Logger()
    

Method Summary
public  voidacquireLock(String path)
    
public synchronized  voidcheckpoint(boolean mode)
     Checkpoints the database.
public  booleancloseLog(int closemode)
     Shuts down the logging process using the specified mode.
public  voidcloseTextCache(Table table)
     Closes the TextCache object.
public  DataFileCachegetCache()
     Returns the Cache object or null if one doesn't exist.
public  intgetLogSize()
    
public  intgetScriptType()
    
public  intgetWriteDelay()
    
public  booleanhasCache()
     Returns the Cache object or null if one doesn't exist.
public  booleanhasLog()
     Determines if the logging process actually does anything.
public synchronized  voidlogConnectUser(Session session)
     Records a Log entry representing a new connection action on the specified Session object.
public  booleanneedsCheckpoint()
    
public  voidopenLog(Database db)
     Opens the specified Database object's database files and starts up the logging process.
public  DataFileCacheopenTextCache(Table table, String source, boolean readOnlyData, boolean reversed)
     Opens the TextCache object.
public  voidreleaseLock()
    
public synchronized  voidsetLogSize(int megas)
     Sets the maximum size to which the log file can grow before being automatically checkpointed.
public synchronized  voidsetScriptType(int i)
    
public synchronized  voidsetWriteDelay(int delay)
     Sets the log write delay mode to number of seconds.
public synchronized  voidsynchLog()
    
public synchronized  voidsynchLogForce()
    
public synchronized  voidwriteCommitStatement(Session session)
    
public synchronized  voidwriteDeleteStatement(Session session, Table t, Object[] row)
    
public synchronized  voidwriteInsertStatement(Session session, Table table, Object[] row)
    
public synchronized  voidwriteSequenceStatement(Session session, NumberSequence s)
    
public synchronized  voidwriteToLog(Session session, String statement)
     Records a Log entry for the specified SQL statement, on behalf of the specified Session object.

Field Detail
appLog
public SimpleLog appLog(Code)



needsCheckpoint
boolean needsCheckpoint(Code)




Constructor Detail
Logger
public Logger()(Code)




Method Detail
acquireLock
public void acquireLock(String path) throws HsqlException(Code)
Attempts to aquire a cooperative lock condition on the database files



checkpoint
public synchronized void checkpoint(boolean mode) throws HsqlException(Code)
Checkpoints the database.

The most important effect of calling this method is to cause the log file to be rewritten in the most efficient form to reflect the current state of the database, i.e. only the DDL and insert DML required to recreate the database in its present state. Other house-keeping duties are performed w.r.t. other database files, in order to ensure as much as possible the ACID properites of the database.
throws:
  HsqlException - if there is a problem checkpointing thedatabase




closeLog
public boolean closeLog(int closemode)(Code)
Shuts down the logging process using the specified mode.


Parameters:
  closemode - The mode in which to shut down the loggingprocess

  1. closemode -1 performs SHUTDOWN IMMEDIATELY, equivalentto a poweroff or crash.
  2. closemode 0 performs a normal SHUTDOWN thatcheckpoints the database normally.
  3. closemode 1 performs a shutdown compact that scriptsout the contents of any CACHED tables to the log thendeletes the existing *.data file that contains the datafor all CACHED table before the normal checkpoint processwhich in turn creates a new, compact *.data file.
  4. closemode 2 performs a SHUTDOWN SCRIPT.
true if closed with no problems or false if a problem wasencountered.



closeTextCache
public void closeTextCache(Table table) throws HsqlException(Code)
Closes the TextCache object.



getCache
public DataFileCache getCache() throws HsqlException(Code)
Returns the Cache object or null if one doesn't exist.



getLogSize
public int getLogSize()(Code)



getScriptType
public int getScriptType()(Code)



getWriteDelay
public int getWriteDelay()(Code)



hasCache
public boolean hasCache()(Code)
Returns the Cache object or null if one doesn't exist.



hasLog
public boolean hasLog()(Code)
Determines if the logging process actually does anything.

In-memory Database objects do not need to log anything. This method is essentially equivalent to testing whether this logger's database is an in-memory mode database. true if this object encapsulates a non-null Log instance,else false




logConnectUser
public synchronized void logConnectUser(Session session) throws HsqlException(Code)
Records a Log entry representing a new connection action on the specified Session object.
Parameters:
  session - the Session object for which to record the logentry
throws:
  HsqlException - if there is a problem recording the Logentry



needsCheckpoint
public boolean needsCheckpoint()(Code)



openLog
public void openLog(Database db) throws HsqlException(Code)
Opens the specified Database object's database files and starts up the logging process.

If the specified Database object is a new database, its database files are first created.
Parameters:
  db - the Database
throws:
  HsqlException - if there is a problem, such as the case whenthe specified files are in use by another process




openTextCache
public DataFileCache openTextCache(Table table, String source, boolean readOnlyData, boolean reversed) throws HsqlException(Code)
Opens the TextCache object.



releaseLock
public void releaseLock()(Code)



setLogSize
public synchronized void setLogSize(int megas)(Code)
Sets the maximum size to which the log file can grow before being automatically checkpointed.
Parameters:
  megas - size in MB



setScriptType
public synchronized void setScriptType(int i) throws HsqlException(Code)
Sets the type of script file, currently 0 for text (default) 1 for binary and 3 for compressed
Parameters:
  i - The type



setWriteDelay
public synchronized void setWriteDelay(int delay)(Code)
Sets the log write delay mode to number of seconds. By default executed commands written to the log are committed fully at most 60 second after they are executed. This improves performance for applications that execute a large number of short running statements in a short period of time, but risks failing to log some possibly large number of statements in the event of a crash. A small value improves recovery. A value of 0 will severly slow down logging when autocommit is on, or many short transactions are committed.
Parameters:
  delay - in seconds



synchLog
public synchronized void synchLog()(Code)
Called after commits or after each statement when autocommit is on



synchLogForce
public synchronized void synchLogForce()(Code)



writeCommitStatement
public synchronized void writeCommitStatement(Session session) throws HsqlException(Code)



writeDeleteStatement
public synchronized void writeDeleteStatement(Session session, Table t, Object[] row) throws HsqlException(Code)



writeInsertStatement
public synchronized void writeInsertStatement(Session session, Table table, Object[] row) throws HsqlException(Code)



writeSequenceStatement
public synchronized void writeSequenceStatement(Session session, NumberSequence s) throws HsqlException(Code)



writeToLog
public synchronized void writeToLog(Session session, String statement) throws HsqlException(Code)
Records a Log entry for the specified SQL statement, on behalf of the specified Session object.
Parameters:
  session - the Session object for which to record the Logentry
Parameters:
  statement - the SQL statement to Log
throws:
  HsqlException - if there is a problem recording the entry



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.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.