Top Description Constructors Methods
org.postgresql.jdbc

public final Class ResourceLock

extends ReentrantLock
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
java.util.concurrent.locks.ReentrantLock

Extends a ReentrantLock for use in try-with-resources block.

Example use

try (ResourceLock ignore = lock.obtain()) {
    // do something while holding the resource lock
  }

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Unlock on exit of try-with-resources block.

public ResourceLock
obtain()

Obtain a lock and return the ResourceLock for use in try-with-resources block.

Inherited from java.util.concurrent.locks.ReentrantLock:
getHoldCountgetOwnergetQueuedThreadsgetQueueLengthgetWaitingThreadsgetWaitQueueLengthhasQueuedThreadhasQueuedThreadshasWaitersisFairisHeldByCurrentThreadisLockedlocklockInterruptiblynewConditiontoStringtryLocktryLockunlock

Constructor Detail

ResourceLockback to summary
public ResourceLock()

Method Detail

closeback to summary
public void close()

Implements java.lang.AutoCloseable.close.

Unlock on exit of try-with-resources block.

Annotations
@Override
obtainback to summary
public ResourceLock obtain()

Obtain a lock and return the ResourceLock for use in try-with-resources block.