Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.concurrency.locking
Class MemoryEntityLockStore

    java.lang.Object
      org.jasig.portal.concurrency.locking.MemoryEntityLockStore

All Implemented Interfaces:
  IEntityLockStore

    public class MemoryEntityLockStore

extends java.lang.Object
implements IEntityLockStore

In-memory store for `IEntityLocks`.

Version:
  $Revision: 1.7 $
Author:
  Dan Ellentuck

Field Summary
`private java.util.Map` | `lockCache`
`private static IEntityLockStore` | `singleton`

Constructor Summary
`MemoryEntityLockStore()` MemoryEntityLockStore constructor comment.

Method Summary
`void` | `add(IEntityLock lock)` Adds this IEntityLock to the store.
`void` | `delete(IEntityLock lock)` Deletes this IEntityLock from the store.
`void` | `deleteAll()` Delete all IEntityLocks from the store.
`void` | `deleteExpired(java.util.Date expiration)` Deletes the expired IEntityLocks from the underlying store.
`IEntityLock[]` | `find(java.lang.Class entityType, java.lang.String entityKey, java.lang.Integer lockType, java.util.Date expiration, java.lang.String lockOwner)` Returns an IEntityLock[] based on the params, any or all of which may be null.
`IEntityLock` | `find(IEntityLock lock)` Returns this lock if it exists in the store.
`IEntityLock[]` | `findUnexpired(java.util.Date expiration, java.lang.Class entityType, java.lang.String entityKey, java.lang.Integer lockType, java.lang.String lockOwner)` Returns an IEntityLock[] containing unexpired locks, based on the params, any or all of which may be null EXCEPT FOR `expiration`.
`private java.lang.String` | `getCacheKey(IEntityLock lock)`
`private java.util.Map` | `getLockCache()`
`private java.util.Map` | `getLockCache(java.lang.Class type)`
`private IEntityLock` | `getLockFromCache(java.lang.Object cacheKey, java.util.Map cache)`
`private void` | `initializeCache()`
`private void` | `primAdd(IEntityLock lock, java.util.Date expiration)` Adds this IEntityLock to the store.
`private void` | `setLockCache(java.util.Map newLockCache)`
`static IEntityLockStore` | `singleton()`
`void` | `update(IEntityLock lock, java.util.Date newExpiration)` Updates the lock's `expiration` in the underlying store.
`void` | `update(IEntityLock lock, java.util.Date newExpiration, java.lang.Integer newLockType)` Make sure the store has a reference to the lock, and then add the lock to refresh the SmartCache wrapper.

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

Field Detail

### singleton

    private static IEntityLockStore singleton

### lockCache

    private java.util.Map lockCache

Constructor Detail

### MemoryEntityLockStore

    public MemoryEntityLockStore()

  MemoryEntityLockStore constructor comment.

Method Detail

### add

    public void add(IEntityLock lock)
             throws LockingException

  Adds this IEntityLock to the store.

  Specified by:
    `add` in interface `IEntityLockStore`
  Parameters:
    `lock` -
  Throws:
    `LockingException`

### delete

    public void delete(IEntityLock lock)
                throws LockingException

  Deletes this IEntityLock from the store.

  Specified by:
    `delete` in interface `IEntityLockStore`
  Parameters:
    `lock` -
  Throws:
    `LockingException`

### deleteAll

    public void deleteAll()

  Description copied from interface: `IEntityLockStore`
  Delete all IEntityLocks from the store.

  Specified by:
    `deleteAll` in interface `IEntityLockStore`

### deleteExpired

    public void deleteExpired(java.util.Date expiration)
                       throws LockingException

  Deletes the expired IEntityLocks from the underlying store.

  Specified by:
    `deleteExpired` in interface `IEntityLockStore`
  Parameters:
    `expiration` - java.util.Date
  Throws:
    `LockingException`

### find

    public IEntityLock[] find(java.lang.Class entityType,
                              java.lang.String entityKey,
                              java.lang.Integer lockType,
                              java.util.Date expiration,
                              java.lang.String lockOwner)
                       throws LockingException

  Returns an IEntityLock[] based on the params, any or all of which may be null. A null param means any value, so `find(myType,myKey,null,null,null)` will return all `IEntityLocks` for myType and myKey.

  Specified by:
    `find` in interface `IEntityLockStore`
  Parameters:
    `entityType` - Class
    `entityKey` - String
    `lockType` - Integer - so we can accept a null value.
    `expiration` - Date
    `lockOwner` - String
  Returns:
    org.jasig.portal.concurrency.locking.IEntityLock[]
  Throws:
    `LockingException` - - wraps an Exception specific to the store.

### find

    public IEntityLock find(IEntityLock lock)
                     throws LockingException

  Returns this lock if it exists in the store.

  Parameters:
    `lock` -
  Returns:
    IEntityLock
  Throws:
    `LockingException`

### findUnexpired

    public IEntityLock[] findUnexpired(java.util.Date expiration,
                                       java.lang.Class entityType,
                                       java.lang.String entityKey,
                                       java.lang.Integer lockType,
                                       java.lang.String lockOwner)
                                throws LockingException

  Returns an IEntityLock[] containing unexpired locks, based on the params, any or all of which may be null EXCEPT FOR `expiration`. A null param means any value, so `find(expir,myType,myKey,null,null)` will return all `IEntityLocks` for myType and myKey unexpired as of `expir`.

  Specified by:
    `findUnexpired` in interface `IEntityLockStore`
  Parameters:
    `expiration` - Date
    `entityType` - Class
    `entityKey` - String
    `lockType` - Integer - so we can accept a null value.
    `lockOwner` - String
  Throws:
    `LockingException` - - wraps an Exception specific to the store.

### getCacheKey

    private java.lang.String getCacheKey(IEntityLock lock)

  Parameters:
    `lock` - org.jasig.portal.concurrency.locking.IEntityLock

### getLockCache

    private java.util.Map getLockCache()

  Returns:
    java.util.Map

### getLockCache

    private java.util.Map getLockCache(java.lang.Class type)

  Returns:
    java.util.Map

### getLockFromCache

    private IEntityLock getLockFromCache(java.lang.Object cacheKey,
                                         java.util.Map cache)

### initializeCache

    private void initializeCache()

### setLockCache

    private void setLockCache(java.util.Map newLockCache)

  Parameters:
    `newLockCache` - java.util.Map

### singleton

    public static IEntityLockStore singleton()

  Returns:
    org.jasig.portal.concurrency.locking.IEntityLockStore

### update

    public void update(IEntityLock lock,
                       java.util.Date newExpiration)
                throws LockingException

  Description copied from interface: `IEntityLockStore`
  Updates the lock's `expiration` in the underlying store.

  Specified by:
    `update` in interface `IEntityLockStore`
  Parameters:
    `lock` -
    `newExpiration` -
  Throws:
    `LockingException`

### update

    public void update(IEntityLock lock,
                       java.util.Date newExpiration,
                       java.lang.Integer newLockType)
                throws LockingException

  Make sure the store has a reference to the lock, and then add the lock to refresh the SmartCache wrapper.

  Specified by:
    `update` in interface `IEntityLockStore`
  Parameters:
    `lock` - org.jasig.portal.concurrency.locking.IEntityLock
    `newExpiration` - java.util.Date
    `newLockType` - Integer
  Throws:
    `LockingException`

### primAdd

    private void primAdd(IEntityLock lock,
                         java.util.Date expiration)
                  throws LockingException

  Adds this IEntityLock to the store.

  Parameters:
    `lock` -
    `expiration` -
  Throws:
    `LockingException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD