Skip to content

Commit

Permalink
Merge pull request #360 from aerospike/stage
Browse files Browse the repository at this point in the history
 Java Client 9.0.2 for JDK21
  • Loading branch information
BrianNichols authored Dec 6, 2024
2 parents ba9880e + 6ec7f1c commit ad1b533
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>9.0.1</version>
<version>9.0.2</version>
</parent>
<artifactId>aerospike-benchmarks</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>9.0.1</version>
<version>9.0.2</version>
</parent>
<artifactId>aerospike-client-jdk21</artifactId>
<packaging>jar</packaging>
Expand Down
7 changes: 5 additions & 2 deletions client/src/com/aerospike/client/async/AsyncTxnAddKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.aerospike.client.AerospikeException;
import com.aerospike.client.Key;
import com.aerospike.client.ResultCode;
import com.aerospike.client.Txn;
import com.aerospike.client.cluster.Cluster;
import com.aerospike.client.command.OperateArgs;
import com.aerospike.client.command.RecordParser;
Expand All @@ -27,11 +28,13 @@
public final class AsyncTxnAddKeys extends AsyncWriteBase {
private final RecordListener listener;
private final OperateArgs args;
private final Txn txn;

public AsyncTxnAddKeys(Cluster cluster, RecordListener listener, Key key, OperateArgs args) {
public AsyncTxnAddKeys(Cluster cluster, RecordListener listener, Key key, OperateArgs args, Txn txn) {
super(cluster, args.writePolicy, key);
this.listener = listener;
this.args = args;
this.txn = txn;
}

@Override
Expand All @@ -42,7 +45,7 @@ protected void writeBuffer() {
@Override
protected boolean parseResult() {
RecordParser rp = new RecordParser(dataBuffer, dataOffset, receiveSize);
rp.parseTranDeadline(policy.txn);
rp.parseTranDeadline(txn);

if (rp.resultCode == ResultCode.OK) {
return true;
Expand Down
5 changes: 3 additions & 2 deletions client/src/com/aerospike/client/async/AsyncTxnMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ private AsyncTxnMonitor(EventLoop eventLoop, Cluster cluster) {
}

void execute(Policy policy, Operation[] ops) {
Key tranKey = TxnMonitor.getTxnMonitorKey(policy.txn);
Txn txn = policy.txn;
Key tranKey = TxnMonitor.getTxnMonitorKey(txn);
WritePolicy wp = TxnMonitor.copyTimeoutPolicy(policy);

RecordListener tranListener = new RecordListener() {
Expand All @@ -175,7 +176,7 @@ public void onFailure(AerospikeException ae) {

// Add write key(s) to MRT monitor.
OperateArgs args = new OperateArgs(wp, null, null, ops);
AsyncTxnAddKeys tranCommand = new AsyncTxnAddKeys(cluster, tranListener, tranKey, args);
AsyncTxnAddKeys tranCommand = new AsyncTxnAddKeys(cluster, tranListener, tranKey, args, txn);
eventLoop.execute(cluster, tranCommand);
}

Expand Down
7 changes: 5 additions & 2 deletions client/src/com/aerospike/client/command/TxnAddKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@
import com.aerospike.client.AerospikeException;
import com.aerospike.client.Key;
import com.aerospike.client.ResultCode;
import com.aerospike.client.Txn;
import com.aerospike.client.cluster.Cluster;
import com.aerospike.client.cluster.Connection;

public final class TxnAddKeys extends SyncWriteCommand {
private final OperateArgs args;
private final Txn txn;

public TxnAddKeys(Cluster cluster, Key key, OperateArgs args) {
public TxnAddKeys(Cluster cluster, Key key, OperateArgs args, Txn txn) {
super(cluster, args.writePolicy, key);
this.args = args;
this.txn = txn;
}

@Override
Expand All @@ -40,7 +43,7 @@ protected void writeBuffer() {
@Override
protected void parseResult(Connection conn) throws IOException {
RecordParser rp = new RecordParser(conn, dataBuffer);
rp.parseTranDeadline(policy.txn);
rp.parseTranDeadline(txn);

if (rp.resultCode == ResultCode.OK) {
return;
Expand Down
6 changes: 3 additions & 3 deletions client/src/com/aerospike/client/command/TxnMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ private static Operation[] getTranOps(Txn txn, ArrayList<Value> list) {
}

private static void addWriteKeys(Cluster cluster, Policy policy, Operation[] ops) {
Key txnKey = getTxnMonitorKey(policy.txn);
Txn txn = policy.txn;
Key txnKey = getTxnMonitorKey(txn);
WritePolicy wp = copyTimeoutPolicy(policy);
OperateArgs args = new OperateArgs(wp, null, null, ops);
TxnAddKeys cmd = new TxnAddKeys(cluster, txnKey, args);
TxnAddKeys cmd = new TxnAddKeys(cluster, txnKey, args, txn);
cmd.execute();
}

Expand All @@ -143,7 +144,6 @@ public static Key getTxnMonitorKey(Txn txn) {
public static WritePolicy copyTimeoutPolicy(Policy policy) {
// Inherit some fields from the original command's policy.
WritePolicy wp = new WritePolicy();
wp.txn = policy.txn;
wp.connectTimeout = policy.connectTimeout;
wp.socketTimeout = policy.socketTimeout;
wp.totalTimeout = policy.totalTimeout;
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>9.0.1</version>
<version>9.0.2</version>
</parent>
<artifactId>aerospike-examples</artifactId>
<packaging>jar</packaging>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<name>aerospike-parent</name>
<version>9.0.1</version>
<version>9.0.2</version>
<packaging>pom</packaging>
<url>https://github.com/aerospike/aerospike-client-java</url>

Expand Down Expand Up @@ -38,7 +38,7 @@
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>

<netty.version>4.1.114.Final</netty.version>
<netty.version>4.1.115.Final</netty.version>
<luaj-jse.version>3.0.1</luaj-jse.version>
<jbcrypt.version>0.4</jbcrypt.version>
<commons-cli.version>1.9.0</commons-cli.version>
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>9.0.1</version>
<version>9.0.2</version>
</parent>
<artifactId>aerospike-client-test</artifactId>
<packaging>jar</packaging>
Expand Down

0 comments on commit ad1b533

Please sign in to comment.