Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.16
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## iaik.pkcs.pkcs11
Class DefaultMutexHandler

    java.lang.Object
      iaik.pkcs.pkcs11.DefaultMutexHandler

All Implemented Interfaces:
  MutexHandler

public class DefaultMutexHandler
extends Object
implements MutexHandler

This class offers a default-implementation of a MutexHandler.

Invariants

Constructor Summary
`DefaultMutexHandler()`

Method Summary
`Object` | `createMutex()` Create a new mutex object.
`void` | `destroyMutex(Object mutex)` Destroy a mutex object.
`void` | `lockMutex(Object mutex)` If this method is called on with a mutex object which is not locked, the calling thread obtains a lock on that mutex object and returns.
`void` | `unlockMutex(Object mutex)` If this method is called with a mutex object which is locked by the calling thread, that mutex object is unlocked and the function call returns.

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

Constructor Detail

### DefaultMutexHandler

    public DefaultMutexHandler()

Method Detail

### createMutex

    public Object createMutex()
                       throws PKCS11Exception

  Create a new mutex object.

  Specified by:
    `createMutex` in interface `MutexHandler`
  Returns:
    The new mutex object.
  Throws:
    `PKCS11Exception` - If the wrapper should return a differnet value than CKR_OK to the library. It gets the error-code and returns it as CK_RV.
  Preconditions
  Postconditions
    (result <> null)

### destroyMutex

    public void destroyMutex(Object mutex)
                      throws PKCS11Exception

  Destroy a mutex object.

  Specified by:
    `destroyMutex` in interface `MutexHandler`
  Parameters:
    `mutex` - The mutex object to destroy.
  Throws:
    `PKCS11Exception` - If the wrapper should return a differnet value than CKR_OK to the library. It gets the error-code and returns it as CK_RV.
  Preconditions
    (mutex <> null)
  Postconditions

### lockMutex

    public void lockMutex(Object mutex)
                   throws PKCS11Exception

  If this method is called on with a mutex object which is not locked, the calling thread obtains a lock on that mutex object and returns. If this method is called with a mutex object which is locked by some thread other than the calling thread, the calling thread blocks and waits for that mutex to be unlocked. If this method is called with a a mutex object which is locked by the calling + thread, the behavior of this method call is undefined.

  Specified by:
    `lockMutex` in interface `MutexHandler`
  Parameters:
    `mutex` - The mutex object to lock.
  Throws:
    `PKCS11Exception` - If the wrapper should return a differnet value than CKR_OK to the library. It gets the error-code and returns it as CK_RV.
  Preconditions
    (mutex <> null)
  Postconditions

### unlockMutex

    public void unlockMutex(Object mutex)
                     throws PKCS11Exception

  If this method is called with a mutex object which is locked by the calling thread, that mutex object is unlocked and the function call returns. Furthermore: If exactly one thread was blocking on that particular mutex object, then that thread stops blocking, obtains a lock on that mutex object, and its lockMutex(Object) call returns. If more than one thread was blocking on that particular mutex objet, then exactly one of the blocking threads is selected somehow. That lucky thread stops blocking, obtains a lock on the mutex object, and its lockMutex(Object) call returns. All other threads blocking on that particular mutex object continue to block. If this method is called with a mutex object which is not locked, then the method call throws an exception with the error code PKCS11Constants.CKR_MUTEX_NOT_LOCKED. If this method is called with a mutex object which is locked by some thread other than the calling thread, the behavior of this method call is undefined.

  Specified by:
    `unlockMutex` in interface `MutexHandler`
  Parameters:
    `mutex` - The mutex object to unlock.
  Throws:
    `PKCS11Exception` - If the wrapper should return a differnet value than CKR_OK to the library. It gets the error-code and returns it as CK_RV.
  Preconditions
    (mutex <> null)
  Postconditions

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.16
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2002, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.