public class DistributedSQLCounter
extends java.lang.Object
| Constructor | Description |
|---|---|
DistributedSQLCounter(java.lang.String field,
java.lang.String table,
SQLConnectionFactory connectionFactory) |
| Modifier and Type | Method | Description |
|---|---|---|
int |
incrementCounterValue(int amount) |
Increments the counter by the given amount and
returns the previous counter value.
|
int |
selectCounterValue() |
Obtains the value of the counter.
|
void |
updateCounterValue(int value) |
Sets the counter to the given value.
|
void |
updateCounterValue(int value,
java.sql.Connection connection) |
Sets the counter to the given value.
|
public DistributedSQLCounter(java.lang.String field,
java.lang.String table,
SQLConnectionFactory connectionFactory)
public int selectCounterValue()
throws java.sql.SQLException
java.sql.SQLException - if querying the database fails.public void updateCounterValue(int value)
throws java.sql.SQLException
value - Value to assign to counter.java.sql.SQLException - if querying the database fails.public void updateCounterValue(int value,
java.sql.Connection connection)
throws java.sql.SQLException
value - Value to assign to counter.connection - Connection to database hosting the counter table.java.sql.SQLException - if querying the database fails.public int incrementCounterValue(int amount)
throws java.sql.SQLException
amount - Amount to increase the counter.java.sql.SQLException - if querying the database fails.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.