com.kuka.geometry.internal
Class MultiLock

java.lang.Object
  extended by com.kuka.geometry.internal.MultiLock

public class MultiLock
extends Object

Allows to obtain and hold up to two locks at once thus avoiding deadlocks. If it is not possible to obtain all locks at once, all locks that were previously obtained are released. After releasing all the locks, the MultiLock implementation tries to obtain all the required locks again


Constructor Summary
MultiLock(Lock lockOne, Lock lockTwo)
          Creates a lock object and additionally obtains all given locks without risking a dead lock.
 
Method Summary
 void unlock()
          Unlock all locks that are held by this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiLock

public MultiLock(Lock lockOne,
                 Lock lockTwo)
Creates a lock object and additionally obtains all given locks without risking a dead lock.

You should ensure to call unlock() by using try..finally after obtaining this instance.

Null values are allowed and will be skipped.

Parameters:
lockOne - the primary lock to be obtained (if not null)
lockTwo - the secondary lock to be obtained (if not null)
Method Detail

unlock

public void unlock()
Unlock all locks that are held by this instance.



Copyright © 2019. All rights reserved.