## org.jboss.ejb.plugins.lock
Class BeanLockSupport

    java.lang.Object
      |
      +--org.jboss.ejb.plugins.lock.BeanLockSupport

All Implemented Interfaces:
  BeanLock

Direct Known Subclasses:
  NoLock, QueuedPessimisticEJBLock, SimplePessimisticEJBLock

public abstract class BeanLockSupport
extends java.lang.Object
implements BeanLock

Support for the BeanLock

Version:
  $Revision: 1.4.4.9 $

  Revisions:

  2001/07/29: marcf

  1. Initial revision
Author:
  Bill Burke, Marc Fleury

Field Summary
`protected java.lang.Object` `id` The Cachekey corresponding to this Bean
`protected int` `numMethodLocks` Number of threads invoking methods on this bean (1 normally >1 if reentrant)
`protected boolean` `reentrant` Are reentrant calls allowed?
`protected int` `refs` Number of threads that retrieved this lock from the manager (0 means removing)
`protected boolean` `synched`
`protected javax.transaction.Transaction` `tx` Transaction holding lock on bean
`protected int` `txTimeout`
`protected static java.util.HashMap` `waiting`

Constructor Summary
`BeanLockSupport()`

Method Summary
`void` `addMethodLock()`
`void` `addRef()`
`void` `addWaiting(javax.transaction.Transaction tx)` Add a transaction waiting for a lock
`void` `deadlockDetection(javax.transaction.Transaction miTx)`
`abstract void` `endTransaction(javax.transaction.Transaction tx)`
`java.lang.Object` `getId()`
`int` `getNumMethodLocks()`
`int` `getRefs()`
`javax.transaction.Transaction` `getTransaction()`
`protected boolean` `isCallAllowed(MethodInvocation mi)`
`boolean` `isMethodLocked()`
`abstract void` `releaseMethodLock()` releaseMethodLock if we reach the count of zero it means the instance is free from threads (and reentrency) we wake up the next thread in the currentLock
`void` `releaseSync()`
`void` `removeRef()`
`void` `removeWaiting(javax.transaction.Transaction tx)` Remove a transaction waiting for a lock
`abstract void` `schedule(MethodInvocation mi)`
`void` `setId(java.lang.Object id)`
`void` `setReentrant(boolean reentrant)`
`void` `setTimeout(int timeout)`
`void` `setTransaction(javax.transaction.Transaction tx)` The setTransaction associates a transaction with the lock.
`void` `sync()`
`abstract void` `wontSynchronize(javax.transaction.Transaction tx)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### numMethodLocks

    protected int numMethodLocks

  Number of threads invoking methods on this bean (1 normally >1 if reentrant)

### refs

    protected int refs

  Number of threads that retrieved this lock from the manager (0 means removing)

### id

    protected java.lang.Object id

  The Cachekey corresponding to this Bean

### reentrant

    protected boolean reentrant

  Are reentrant calls allowed?

### tx

    protected javax.transaction.Transaction tx

  Transaction holding lock on bean

### synched

    protected boolean synched

### txTimeout

    protected int txTimeout

### waiting

    protected static java.util.HashMap waiting

Constructor Detail

### BeanLockSupport

    public BeanLockSupport()

Method Detail

### setId

    public void setId(java.lang.Object id)

  Specified by:
    `setId` in interface `BeanLock`

### getId

    public java.lang.Object getId()

  Specified by:
    `getId` in interface `BeanLock`

### setReentrant

    public void setReentrant(boolean reentrant)

  Specified by:
    `setReentrant` in interface `BeanLock`

### setTimeout

    public void setTimeout(int timeout)

  Specified by:
    `setTimeout` in interface `BeanLock`

### sync

    public void sync()

  Specified by:
    `sync` in interface `BeanLock`

### releaseSync

    public void releaseSync()

  Specified by:
    `releaseSync` in interface `BeanLock`

### schedule

    public abstract void schedule(MethodInvocation mi)
                           throws java.lang.Exception

  Specified by:
    `schedule` in interface `BeanLock`

### setTransaction

    public void setTransaction(javax.transaction.Transaction tx)

  The setTransaction associates a transaction with the lock. The current transaction is associated by the schedule call.
  Specified by:
    `setTransaction` in interface `BeanLock`

### getTransaction

    public javax.transaction.Transaction getTransaction()

  Specified by:
    `getTransaction` in interface `BeanLock`

### endTransaction

    public abstract void endTransaction(javax.transaction.Transaction tx)

  Specified by:
    `endTransaction` in interface `BeanLock`

### wontSynchronize

    public abstract void wontSynchronize(javax.transaction.Transaction tx)

  Specified by:
    `wontSynchronize` in interface `BeanLock`

### isMethodLocked

    public boolean isMethodLocked()

  Specified by:
    `isMethodLocked` in interface `BeanLock`

### getNumMethodLocks

    public int getNumMethodLocks()

  Specified by:
    `getNumMethodLocks` in interface `BeanLock`

### addMethodLock

    public void addMethodLock()

  Specified by:
    `addMethodLock` in interface `BeanLock`

### releaseMethodLock

    public abstract void releaseMethodLock()

  Description copied from interface: `BeanLock`
  releaseMethodLock if we reach the count of zero it means the instance is free from threads (and reentrency) we wake up the next thread in the currentLock
  Specified by:
    `releaseMethodLock` in interface `BeanLock`

### addRef

    public void addRef()

  Specified by:
    `addRef` in interface `BeanLock`

### removeRef

    public void removeRef()

  Specified by:
    `removeRef` in interface `BeanLock`

### getRefs

    public int getRefs()

  Specified by:
    `getRefs` in interface `BeanLock`

### isCallAllowed

    protected boolean isCallAllowed(MethodInvocation mi)

### deadlockDetection

    public void deadlockDetection(javax.transaction.Transaction miTx)
                           throws ApplicationDeadlockException

### addWaiting

    public void addWaiting(javax.transaction.Transaction tx)

  Add a transaction waiting for a lock

### removeWaiting

    public void removeWaiting(javax.transaction.Transaction tx)

  Remove a transaction waiting for a lock

Copyright © 2000 The JBoss Organization. All Rights Reserved.