Show TOC

Background documentationReleasing Locks with the TableLocking API Locate this document in the navigation structure

 

Besides the automatic release of locks at the end of a transaction, locks can also be released manually by using the method unlock lock of the interface TableLocking:

Syntax Syntax

  1. public void unlock(byte lifetime, 
    				   Connection connection, 
    				   String tableName, 
    				   Map primaryKeys, 
    				   char mode) 
    				   throws TechnicalLockException, 
    						IllegalArgumentException;
    
End of the code.

The parameters have the same meaning as those for setting locks. You can use the unlockAll method to release all set locks:

Syntax Syntax

  1. public void unlockAll(byte lifetime) 
    					  throws TechnicalLockException, 
    							 IllegalArgumentException;
    
End of the code.

For each of these methods there is an overloaded method with an additional boolean parameter asynchronous, which specifies whether the lock can also be released asynchronously. By transferring the value false, the synchronous mode is forced. Otherwise, the profile parameter settings of the enqueue server are valid here.

Note Note

We recommend that you use transactional locks (locks with a lifetime of the transaction). These locks are automatically released at the end of the transaction. Nontransactional locks with the lifetime of the user session are automatically released at the end of a UserSession (at the latest, when the user session times out).

End of the note.