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


org.apache.derby.iapi.store.raw.LockingPolicy

All known Subclasses:   org.apache.derby.impl.store.raw.xact.NoLocking,
LockingPolicy
public interface LockingPolicy (Code)
Any object that implements this interface can be used as a locking policy for accessing a container.

The locking policy must use the defined lock qualifiers (ContainerLock.CIS, RowLock.RS, etc.) and the standard lock manager. (A locking policy that just performs no locking wouldn't need to use these :-)

A locking policy must use the object that is an instance of Transaction (originally obtained via startTransaction() in RawStoreFactory) as the compatibilitySpace for the LockFactory calls.
A locking policy must use the passed in transaction as the compatability space and the lock group. This chain (group) of locks has the following defined behaviour

  • Locks are released at transaction.commit()
  • Locks are released at transaction.abort()

MT - Thread Safe
See Also:   ContainerHandle
See Also:   RecordHandle
See Also:   org.apache.derby.iapi.services.locks.LockFactory
See Also:   org.apache.derby.iapi.services.locks.Lockable


Field Summary
final static  intMODE_CONTAINER
     ContainerHandle level locking.
final static  intMODE_NONE
     No locking what so ever, isolation parameter will be ignored by getLockingPolicy().
final static  intMODE_RECORD
     Record level locking.


Method Summary
public  intgetMode()
    
public  booleanlockContainer(Transaction t, ContainerHandle container, boolean waitForLock, boolean forUpdate)
     Called when a container is opened.
Parameters:
  t - Transaction to associate lock with.
Parameters:
  container - Container to lock.
Parameters:
  waitForLock - Should lock request wait until granted?
Parameters:
  forUpdate - Should container be locked for update, or read? true if the lock was obtained, false if it wasn't.
public  booleanlockRecordForRead(Transaction t, ContainerHandle container, RecordHandle record, boolean waitForLock, boolean forUpdate)
     Called before a record is fetched.
Parameters:
  t - Transaction to associate lock with.
Parameters:
  container - Open Container used to get record.
public  voidlockRecordForRead(Latch latch, RecordHandle record, boolean forUpdate)
     Lock a record while holding a page latch.
public  booleanlockRecordForWrite(Transaction t, RecordHandle record, boolean lockForInsert, boolean waitForLock)
     Called before a record is inserted, updated or deleted. If zeroDuration is true then lock is released immediately after it has been granted.
Parameters:
  t - Transaction to associate lock with.
Parameters:
  record - Record to lock.
Parameters:
  lockForInsert - Lock is for an insert.
Parameters:
  waitForLock - Should lock request wait until granted? true if the lock was obtained, false if it wasn't.
public  voidlockRecordForWrite(Latch latch, RecordHandle record)
     Lock a record for write while holding a page latch.
public  voidunlockContainer(Transaction t, ContainerHandle container)
     Called when a container is closed.
public  voidunlockRecordAfterRead(Transaction t, ContainerHandle container, RecordHandle record, boolean forUpdate, boolean row_qualified)
     Called after a record has been fetched.
public  booleanzeroDurationLockRecordForWrite(Transaction t, RecordHandle record, boolean lockForPreviousKey, boolean waitForLock)
     Request a write lock which will be released immediately upon grant.
Parameters:
  t - Transaction to associate lock with.
Parameters:
  record - Record to lock.
Parameters:
  lockForPreviousKey - Lock is for a previous key of a insert.
Parameters:
  waitForLock - Should lock request wait until granted? true if the lock was obtained, false if it wasn't.

Field Detail
MODE_CONTAINER
final static int MODE_CONTAINER(Code)
ContainerHandle level locking.



MODE_NONE
final static int MODE_NONE(Code)
No locking what so ever, isolation parameter will be ignored by getLockingPolicy().
See Also:   RawStoreFactory



MODE_RECORD
final static int MODE_RECORD(Code)
Record level locking.





Method Detail
getMode
public int getMode()(Code)
Get the mode of this policy



lockContainer
public boolean lockContainer(Transaction t, ContainerHandle container, boolean waitForLock, boolean forUpdate) throws StandardException(Code)
Called when a container is opened.
Parameters:
  t - Transaction to associate lock with.
Parameters:
  container - Container to lock.
Parameters:
  waitForLock - Should lock request wait until granted?
Parameters:
  forUpdate - Should container be locked for update, or read? true if the lock was obtained, false if it wasn't. False should only be returned if the waitForLock policy was set to"false," and the lock was unavailable.
exception:
  StandardException - Standard Cloudscape error policy
See Also:   ContainerHandle



lockRecordForRead
public boolean lockRecordForRead(Transaction t, ContainerHandle container, RecordHandle record, boolean waitForLock, boolean forUpdate) throws StandardException(Code)
Called before a record is fetched.
Parameters:
  t - Transaction to associate lock with.
Parameters:
  container - Open Container used to get record. Will be usedto row locks by the container they belong to.
Parameters:
  record - Record to lock.
Parameters:
  waitForLock - Should lock request wait until granted?
Parameters:
  forUpdate - Should container be locked for update, or read?
exception:
  StandardException - Standard Cloudscape error policy
See Also:   Page



lockRecordForRead
public void lockRecordForRead(Latch latch, RecordHandle record, boolean forUpdate) throws StandardException(Code)
Lock a record while holding a page latch.
Parameters:
  latch - Latch held.
Parameters:
  record - Record to lock.
Parameters:
  forUpdate - Should container be locked for update, or read?
exception:
  StandardException - Standard Cloudscape error policy
See Also:   Page



lockRecordForWrite
public boolean lockRecordForWrite(Transaction t, RecordHandle record, boolean lockForInsert, boolean waitForLock) throws StandardException(Code)
Called before a record is inserted, updated or deleted. If zeroDuration is true then lock is released immediately after it has been granted.
Parameters:
  t - Transaction to associate lock with.
Parameters:
  record - Record to lock.
Parameters:
  lockForInsert - Lock is for an insert.
Parameters:
  waitForLock - Should lock request wait until granted? true if the lock was obtained, false if it wasn't. False should only be returned if the waitForLock argument was set to"false," and the lock was unavailable.
exception:
  StandardException - Standard Cloudscape error policy
See Also:   Page



lockRecordForWrite
public void lockRecordForWrite(Latch latch, RecordHandle record) throws StandardException(Code)
Lock a record for write while holding a page latch.
Parameters:
  latch - Page latch held.
Parameters:
  record - Record to lock.
exception:
  StandardException - Standard Cloudscape error policy
See Also:   Page



unlockContainer
public void unlockContainer(Transaction t, ContainerHandle container)(Code)
Called when a container is closed.
See Also:   ContainerHandle
See Also:   ContainerHandle.close



unlockRecordAfterRead
public void unlockRecordAfterRead(Transaction t, ContainerHandle container, RecordHandle record, boolean forUpdate, boolean row_qualified) throws StandardException(Code)
Called after a record has been fetched.
exception:
  StandardException - Standard Cloudscape error policy
See Also:   Page



zeroDurationLockRecordForWrite
public boolean zeroDurationLockRecordForWrite(Transaction t, RecordHandle record, boolean lockForPreviousKey, boolean waitForLock) throws StandardException(Code)
Request a write lock which will be released immediately upon grant.
Parameters:
  t - Transaction to associate lock with.
Parameters:
  record - Record to lock.
Parameters:
  lockForPreviousKey - Lock is for a previous key of a insert.
Parameters:
  waitForLock - Should lock request wait until granted? true if the lock was obtained, false if it wasn't. False should only be returned if the waitForLock argument was set to"false," and the lock was unavailable.
exception:
  StandardException - Standard Cloudscape error policy
See Also:   Page



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.