Java Doc for Locker.java in  » JMX » je » com » sleepycat » je » txn » 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 » JMX » je » com.sleepycat.je.txn 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sleepycat.je.txn.Locker

All known Subclasses:   com.sleepycat.je.txn.Txn,  com.sleepycat.je.txn.BasicLocker,
Locker
abstract public class Locker (Code)
Locker instances are JE's route to locking and transactional support. This class is the abstract base class for BasicLocker, ThreadLocker, Txn and AutoTxn. Locker instances are in fact only a transaction shell to get to the lock manager, and don't guarantee transactional semantics. Txn and AutoTxn instances are both truely transactional, but have different ending behaviors.


Field Summary
protected  booleandefaultNoWait
    
protected  MapdeleteInfo
    
protected  EnvironmentImplenvImpl
    
protected  MaphandleLockToHandleMap
    
protected  MaphandleToHandleLockMap
    
protected  longid
    
protected  LockManagerlockManager
    
protected  longlockTimeOutMillis
    
protected  booleanreadUncommittedDefault
    
protected  Threadthread
     The thread that created this locker.

Constructor Summary
public  Locker(EnvironmentImpl envImpl, boolean readUncommittedDefault, boolean noWait)
     Create a locker id.
 Locker()
     For reading from the log.

Method Summary
public  voidaddDeleteInfo(BIN bin, Key deletedKey)
     Add delete information, to be added to the inCompressor queue when the transaction ends.
abstract  voidaddLock(Long nodeId, LockType type, LockGrantType grantStatus)
     Add a lock to set owned by this transaction.
public  voidaddToHandleMaps(Long handleLockId, Database databaseHandle)
     Remember how handle locks and handles match up.
abstract protected  voidcheckState(boolean ignoreCalledByAbort)
    
abstract public  LockStatscollectStats(LockStats stats)
     Get lock count, for per transaction lock stats, for internal debugging.
abstract public  booleancreatedNode(long nodeId)
    
public  voiddemoteLock(long nodeId)
     Revert this lock from a write lock to a read lock.
public  voiddumpLockTable()
    
abstract protected  longgenerateId(TxnManager txnManager)
     A Locker has to generate its next id.
abstract public  longgetAbortLsn(long nodeId)
    
public  booleangetDefaultNoWait()
    
public  longgetId()
    
public synchronized  longgetLockTimeout()
    
abstract public  TxngetTxnLocker()
     Returns the underlying Txn if the locker is transactional, or null if the locker is non-transactional.
 longgetTxnStartMillis()
    
public  longgetTxnTimeOut()
    
 LockgetWaitingFor()
    
abstract public  WriteLockInfogetWriteLockInfo(long nodeId)
    
public  booleanisHandleLockTransferrable()
    
abstract public  booleanisReadCommittedIsolation()
     Returns whether the isolation level of this locker is read-committed.
public  booleanisReadUncommittedDefault()
    
abstract public  booleanisSerializableIsolation()
     Returns whether the isolation level of this locker is serializable.
public  booleanisTimedOut()
    
abstract public  booleanisTransactional()
     Returns whether this locker is transactional.
public  LockResultlock(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database)
     Request a blocking or non-blocking lock of the given type on the given nodeId.
Parameters:
  nodeId - is the node to lock.
Parameters:
  lockType - is the type of lock to request.
Parameters:
  noWait - is true to override the defaultNoWait setting.
abstract  LockResultlockInternal(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database)
     Abstract method to a blocking or non-blocking lock of the given type on the given nodeId.
abstract public  voidmarkDeleteAtTxnEnd(DatabaseImpl db, boolean deleteAtCommit)
     Database operations like remove and truncate leave behind residual DatabaseImpls that must be purged at transaction commit or abort.
abstract  voidmoveWriteToReadLock(long nodeId, Lock lock)
     A lock is being demoted.
abstract public  LockernewNonTxnLocker()
     Creates a fresh non-transactional locker, while retaining any transactional locks held by this locker.
public  LockResultnonBlockingLock(long nodeId, LockType lockType, DatabaseImpl database)
     Request a non-blocking lock of the given type on the given nodeId.

Unlike lock(), this method returns LockGrantType.DENIED if the lock is denied rather than throwing LockNotGrantedException.

abstract public  voidoperationEnd()
     The equivalent of calling operationEnd(true).
abstract public  voidoperationEnd(boolean operationOK)
     Different types of transactions do different things when the operation ends.
public  voidoperationEnd(OperationStatus status)
     A SUCCESS status equals operationOk.
abstract public  voidregisterCursor(CursorImpl cursor)
     Tell this transaction about a cursor.
public  voidreleaseLock(long nodeId)
     Release the lock on this LN and remove from the transaction's owning set.
abstract public  voidreleaseNonTxnLocks()
     Releases any non-transactional locks held by this locker.
abstract  voidremoveLock(long nodeId)
     Remove the lock from the set owned by this transaction.
abstract public  voidsetHandleLockOwner(boolean operationOK, Database dbHandle, boolean dbIsClosing)
     We're at the end of an operation.
public synchronized  voidsetLockTimeout(long timeout)
     Set the lock timeout period for any locks in this transaction, in milliseconds.
Parameters:
  timeout - The timeout value for the transaction lifetime, inmilliseconds.
 voidsetOnlyAbortable()
     Set the state of a transaction to ONLY_ABORTABLE.
public synchronized  voidsetTxnTimeout(long timeout)
     Set the timeout period for this transaction, in milliseconds.
Parameters:
  timeout - The timeout value for the transaction lifetime, inmilliseconds.
 voidsetWaitingFor(Lock lock)
    
public  booleansharesLocksWith(Locker other)
     Returns whether this locker can share locks with the given locker.

All lockers share locks with a BuddyLocker whose buddy is this locker.

public  StringtoString()
    
public  voidtransferHandleLock(Database dbHandle, Locker destLocker, boolean demoteToRead)
    
 voidtransferHandleLockToHandle(Database dbHandle)
     The currentTxn passes responsiblity for this db handle lock to a txn owned by the Database object.
abstract public  voidunRegisterCursor(CursorImpl cursor)
     Remove a cursor from this txn.
 voidunregisterHandle(Database dbHandle)
    

Field Detail
defaultNoWait
protected boolean defaultNoWait(Code)



deleteInfo
protected Map deleteInfo(Code)



envImpl
protected EnvironmentImpl envImpl(Code)



handleLockToHandleMap
protected Map handleLockToHandleMap(Code)



handleToHandleLockMap
protected Map handleToHandleLockMap(Code)



id
protected long id(Code)



lockManager
protected LockManager lockManager(Code)



lockTimeOutMillis
protected long lockTimeOutMillis(Code)



readUncommittedDefault
protected boolean readUncommittedDefault(Code)



thread
protected Thread thread(Code)
The thread that created this locker. Used for debugging, and by the ThreadLocker subclass. Note that thread may be null if the Locker is instantiated by reading the log.




Constructor Detail
Locker
public Locker(EnvironmentImpl envImpl, boolean readUncommittedDefault, boolean noWait) throws DatabaseException(Code)
Create a locker id. This constructor is called very often, so it should be as streamlined as possible.
Parameters:
  lockManager - lock manager for this environment
Parameters:
  readUncommittedDefault - if true, this transaction doesread-uncommitted by default
Parameters:
  noWait - if true, non-blocking lock requests are used.



Locker
Locker()(Code)
For reading from the log.




Method Detail
addDeleteInfo
public void addDeleteInfo(BIN bin, Key deletedKey) throws DatabaseException(Code)
Add delete information, to be added to the inCompressor queue when the transaction ends.



addLock
abstract void addLock(Long nodeId, LockType type, LockGrantType grantStatus) throws DatabaseException(Code)
Add a lock to set owned by this transaction.



addToHandleMaps
public void addToHandleMaps(Long handleLockId, Database databaseHandle)(Code)
Remember how handle locks and handles match up.



checkState
abstract protected void checkState(boolean ignoreCalledByAbort) throws DatabaseException(Code)



collectStats
abstract public LockStats collectStats(LockStats stats) throws DatabaseException(Code)
Get lock count, for per transaction lock stats, for internal debugging.



createdNode
abstract public boolean createdNode(long nodeId) throws DatabaseException(Code)
true if this transaction created this node,for a operation with transactional semantics.



demoteLock
public void demoteLock(long nodeId) throws DatabaseException(Code)
Revert this lock from a write lock to a read lock.



dumpLockTable
public void dumpLockTable() throws DatabaseException(Code)
Dump lock table, for debugging



generateId
abstract protected long generateId(TxnManager txnManager)(Code)
A Locker has to generate its next id. Some subtypes, like BasicLocker, have a single id for all instances because they are never used for recovery. Other subtypes ask the txn manager for an id.



getAbortLsn
abstract public long getAbortLsn(long nodeId) throws DatabaseException(Code)
the abort LSN for this node.



getDefaultNoWait
public boolean getDefaultNoWait()(Code)
the default no-wait (non-blocking) setting.



getId
public long getId()(Code)
the transaction's id.



getLockTimeout
public synchronized long getLockTimeout()(Code)
Get the lock timeout period for this transaction, in milliseconds



getTxnLocker
abstract public Txn getTxnLocker()(Code)
Returns the underlying Txn if the locker is transactional, or null if the locker is non-transactional. For a Txn-based locker, this method returns 'this'. For a BuddyLocker, this method may returns the buddy.



getTxnStartMillis
long getTxnStartMillis()(Code)



getTxnTimeOut
public long getTxnTimeOut()(Code)



getWaitingFor
Lock getWaitingFor()(Code)



getWriteLockInfo
abstract public WriteLockInfo getWriteLockInfo(long nodeId) throws DatabaseException(Code)
the WriteLockInfo for this node.



isHandleLockTransferrable
public boolean isHandleLockTransferrable()(Code)
true if this txn is willing to give up the handle lock toanother txn before this txn ends.



isReadCommittedIsolation
abstract public boolean isReadCommittedIsolation()(Code)
Returns whether the isolation level of this locker is read-committed.



isReadUncommittedDefault
public boolean isReadUncommittedDefault()(Code)
true if transaction was created with read-uncommitted as adefault.



isSerializableIsolation
abstract public boolean isSerializableIsolation()(Code)
Returns whether the isolation level of this locker is serializable.



isTimedOut
public boolean isTimedOut() throws DatabaseException(Code)



isTransactional
abstract public boolean isTransactional()(Code)
Returns whether this locker is transactional.



lock
public LockResult lock(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database) throws LockNotGrantedException, DeadlockException, DatabaseException(Code)
Request a blocking or non-blocking lock of the given type on the given nodeId.
Parameters:
  nodeId - is the node to lock.
Parameters:
  lockType - is the type of lock to request.
Parameters:
  noWait - is true to override the defaultNoWait setting. If true,or if defaultNoWait is true, throws LockNotGrantedException if the lockcannot be granted without waiting.
Parameters:
  database - is the database containing nodeId.
throws:
  LockNotGrantedException - if a non-blocking lock was denied.
throws:
  DeadlockException - if acquiring a blocking lock would result in adeadlock.



lockInternal
abstract LockResult lockInternal(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database) throws DeadlockException, DatabaseException(Code)
Abstract method to a blocking or non-blocking lock of the given type on the given nodeId. Unlike the lock() method, this method does not throw LockNotGrantedException and can therefore be used by nonBlockingLock to probe for a lock without the overhead of an exception stack trace.
Parameters:
  nodeId - is the node to lock.
Parameters:
  lockType - is the type of lock to request.
Parameters:
  noWait - is true to override the defaultNoWait setting. If true,or if defaultNoWait is true, throws LockNotGrantedException if the lockcannot be granted without waiting.
Parameters:
  database - is the database containing nodeId.
throws:
  DeadlockException - if acquiring a blocking lock would result in adeadlock.



markDeleteAtTxnEnd
abstract public void markDeleteAtTxnEnd(DatabaseImpl db, boolean deleteAtCommit) throws DatabaseException(Code)
Database operations like remove and truncate leave behind residual DatabaseImpls that must be purged at transaction commit or abort.



moveWriteToReadLock
abstract void moveWriteToReadLock(long nodeId, Lock lock)(Code)
A lock is being demoted. Move it from the write collection into the read collection.



newNonTxnLocker
abstract public Locker newNonTxnLocker() throws DatabaseException(Code)
Creates a fresh non-transactional locker, while retaining any transactional locks held by this locker. This method is called when the cursor for this locker is cloned.

In general, transactional lockers return 'this' when this method is called, while non-transactional lockers return a new instance.




nonBlockingLock
public LockResult nonBlockingLock(long nodeId, LockType lockType, DatabaseImpl database) throws DatabaseException(Code)
Request a non-blocking lock of the given type on the given nodeId.

Unlike lock(), this method returns LockGrantType.DENIED if the lock is denied rather than throwing LockNotGrantedException. This method should therefore not be used as the final lock for a user operation, since in that case LockNotGrantedException should be thrown for a denied lock. It is normally used only to probe for a lock, and other recourse is taken if the lock is denied.


Parameters:
  nodeId - is the node to lock.
Parameters:
  lockType - is the type of lock to request.
Parameters:
  database - is the database containing nodeId.



operationEnd
abstract public void operationEnd() throws DatabaseException(Code)
The equivalent of calling operationEnd(true).



operationEnd
abstract public void operationEnd(boolean operationOK) throws DatabaseException(Code)
Different types of transactions do different things when the operation ends. Txns do nothing, AutoTxns commit or abort, and BasicLockers and ThreadLockers just release locks.
Parameters:
  operationOK - is whether the operation succeeded, sincethat may impact ending behavior. (i.e for AutoTxn)



operationEnd
public void operationEnd(OperationStatus status) throws DatabaseException(Code)
A SUCCESS status equals operationOk.



registerCursor
abstract public void registerCursor(CursorImpl cursor) throws DatabaseException(Code)
Tell this transaction about a cursor.



releaseLock
public void releaseLock(long nodeId) throws DatabaseException(Code)
Release the lock on this LN and remove from the transaction's owning set.



releaseNonTxnLocks
abstract public void releaseNonTxnLocks() throws DatabaseException(Code)
Releases any non-transactional locks held by this locker. This method is called when the cursor moves to a new position or is closed.

In general, transactional lockers do nothing when this method is called, while non-transactional lockers release all locks as if operationEnd were called.




removeLock
abstract void removeLock(long nodeId) throws DatabaseException(Code)
Remove the lock from the set owned by this transaction. If specified to LockManager.release, the lock manager will call this when its releasing a lock.



setHandleLockOwner
abstract public void setHandleLockOwner(boolean operationOK, Database dbHandle, boolean dbIsClosing) throws DatabaseException(Code)
We're at the end of an operation. Move this handle lock to the appropriate owner.



setLockTimeout
public synchronized void setLockTimeout(long timeout)(Code)
Set the lock timeout period for any locks in this transaction, in milliseconds.
Parameters:
  timeout - The timeout value for the transaction lifetime, inmilliseconds. A value of 0 disables timeouts for the transaction.
throws:
  IllegalArgumentException - If the value of timeout is negative.



setOnlyAbortable
void setOnlyAbortable()(Code)
Set the state of a transaction to ONLY_ABORTABLE.



setTxnTimeout
public synchronized void setTxnTimeout(long timeout)(Code)
Set the timeout period for this transaction, in milliseconds.
Parameters:
  timeout - The timeout value for the transaction lifetime, inmilliseconds. A value of 0 disables timeouts for the transaction.
throws:
  IllegalArgumentException - If the value of timeout is negative.



setWaitingFor
void setWaitingFor(Lock lock)(Code)



sharesLocksWith
public boolean sharesLocksWith(Locker other)(Code)
Returns whether this locker can share locks with the given locker.

All lockers share locks with a BuddyLocker whose buddy is this locker. To support BuddyLocker when overriding this method, always return true if this implementation (super.sharesLocksWith(...)) returns true.




toString
public String toString()(Code)



transferHandleLock
public void transferHandleLock(Database dbHandle, Locker destLocker, boolean demoteToRead) throws DatabaseException(Code)



transferHandleLockToHandle
void transferHandleLockToHandle(Database dbHandle) throws DatabaseException(Code)
The currentTxn passes responsiblity for this db handle lock to a txn owned by the Database object.



unRegisterCursor
abstract public void unRegisterCursor(CursorImpl cursor) throws DatabaseException(Code)
Remove a cursor from this txn.



unregisterHandle
void unregisterHandle(Database dbHandle)(Code)
Remove this Database from the protected Database handle set



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.