Skip to content

Commit

Permalink
Refine logs in listeners (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
reugn authored Dec 13, 2023
1 parent f4fe401 commit ad9c75c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/aerospike/jdbc/AerospikeConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void rollback() throws SQLException {

@Override
public void close() {
logger.info(() -> "Close AerospikeConnection");
client.close();
closed = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.aerospike.client.query.KeyRecord;
import com.aerospike.jdbc.model.DriverPolicy;

import java.util.logging.Level;
import java.util.logging.Logger;

public class RecordSetBatchSequenceListener implements BatchSequenceListener {
Expand Down Expand Up @@ -35,7 +36,7 @@ public void onSuccess() {

@Override
public void onFailure(AerospikeException e) {
logger.warning(e::getMessage);
logger.log(Level.SEVERE, "Aerospike listener failure", e);
recordSet.abort();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import com.aerospike.client.AerospikeException;
import com.aerospike.client.Key;
import com.aerospike.client.Record;
import com.aerospike.client.ResultCode;
import com.aerospike.client.listener.RecordSequenceListener;
import com.aerospike.client.query.KeyRecord;
import com.aerospike.jdbc.model.DriverPolicy;

import java.util.logging.Level;
import java.util.logging.Logger;

public class RecordSetRecordSequenceListener implements RecordSequenceListener {
Expand Down Expand Up @@ -34,7 +36,11 @@ public void onSuccess() {

@Override
public void onFailure(AerospikeException exception) {
logger.warning(exception::getMessage);
if (exception.getResultCode() == ResultCode.QUERY_TERMINATED) {
logger.warning(exception::getMessage);
} else {
logger.log(Level.SEVERE, "Aerospike listener failure", exception);
}
recordSet.abort();
}

Expand Down

0 comments on commit ad9c75c

Please sign in to comment.