Class PostgreSQLadvisoryLockBasedProxyManager<K>

  • Type Parameters:
    K - type of primary key
    All Implemented Interfaces:
    ProxyManager<K>

    public class PostgreSQLadvisoryLockBasedProxyManager<K>
    extends AbstractLockBasedProxyManager<K>
    Author:
    Maxim Bartkov The extension of Bucket4j library addressed to support PostgreSQL To start work with the PostgreSQL extension you must create a table, which will include the possibility to work with buckets In order to do this, your table should include the next columns: id as a PRIMARY KEY (BIGINT) and state (BYTEA) To define column names, SQLProxyConfiguration include BucketTableSettings which takes settings for the table to work with Bucket4j.

    This implementation solves transaction related problems via pg_advisory_xact_lock locks an application-defined resource, which can be identified either by a single 64-bit key value or two 32-bit key values (note that these two key spaces do not overlap). If another session already holds a lock on the same resource identifier, this function will wait until the resource becomes available. The lock is exclusive. Multiple lock requests stack so that if the same resource is locked three times it must then be unlocked three times to be released for other sessions use. The lock is automatically released at the end of the current transaction and cannot be released explicitly.