Class PostgreSQLSelectForUpdateBasedProxyManager<K>

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

    public class PostgreSQLSelectForUpdateBasedProxyManager<K>
    extends AbstractSelectForUpdateBasedProxyManager<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 Based on SELECT FOR UPDATE SQL syntax. This prevents them from being modified or deleted by other transactions until the current transaction ends. That is, other transactions that attempt UPDATE, DELETE, or SELECT FOR UPDATE of these rows will be blocked until the current transaction ends. Also, if an UPDATE, DELETE, or SELECT FOR UPDATE from another transaction has already locked a selected row or rows, SELECT FOR UPDATE will wait for the other transaction to complete, and will then lock and return the updated row (or no row, if the row was deleted). Within a SERIALIZABLE transaction, however, an error will be thrown if a row to be locked has changed since the transaction started.