Skip to content

Commit

Permalink
Merge pull request #349 from aerospike/stage
Browse files Browse the repository at this point in the history
Java Client 9.0.0 for JDK21
  • Loading branch information
BrianNichols authored Nov 19, 2024
2 parents ae18ca8 + 3a77e18 commit 3977e29
Show file tree
Hide file tree
Showing 171 changed files with 6,516 additions and 11,982 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/build-proxy.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Aerospike Java Client Package
Aerospike Java client. This package contains full source code for these projects.

* client: Java native client library.
* proxy: Java proxy client library for dbaas (database as a service).
* examples: Java client examples.
* benchmarks: Java client benchmarks.
* test: Java client unit tests.
Expand Down
57 changes: 21 additions & 36 deletions 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>8.1.4</version>
<version>9.0.0</version>
</parent>
<artifactId>aerospike-benchmarks</artifactId>
<packaging>jar</packaging>
Expand All @@ -18,11 +18,6 @@
<artifactId>aerospike-client-jdk21</artifactId>
</dependency>

<dependency>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-proxy-client</artifactId>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
Expand Down Expand Up @@ -64,46 +59,36 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.aerospike.benchmarks.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-my-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
<goal>single</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jar-with-dependencies</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.aerospike.benchmarks.Main</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

</project>
31 changes: 3 additions & 28 deletions benchmarks/src/com/aerospike/benchmarks/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

import com.aerospike.client.AerospikeClient;
import com.aerospike.client.Host;
import com.aerospike.client.IAerospikeClient;
import com.aerospike.client.Key;
Expand All @@ -62,11 +63,9 @@
import com.aerospike.client.policy.Replica;
import com.aerospike.client.policy.TlsPolicy;
import com.aerospike.client.policy.WritePolicy;
import com.aerospike.client.proxy.AerospikeClientFactory;
import com.aerospike.client.util.Util;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.kqueue.KQueueEventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
Expand Down Expand Up @@ -105,7 +104,6 @@ public static void main(String[] args) {
private int nThreads;
private int asyncMaxCommands = 100;
private int eventLoopSize = 1;
private boolean useProxyClient;
private boolean useVirtualThreads;
private boolean asyncEnabled;
private boolean initialize;
Expand Down Expand Up @@ -349,8 +347,6 @@ public Main(String[] commandLineArgs) throws Exception {
"Value: DIRECT_NIO | NETTY_NIO | NETTY_EPOLL | NETTY_KQUEUE | NETTY_IOURING"
);

options.addOption("proxy", false, "Use proxy client.");

options.addOption("upn", "udfPackageName", true, "Specify the package name where the udf function is located");
options.addOption("ufn", "udfFunctionName", true, "Specify the udf function name that must be used in the udf benchmarks");
options.addOption("ufv","udfFunctionValues",true, "The udf argument values comma separated");
Expand Down Expand Up @@ -382,10 +378,6 @@ public Main(String[] commandLineArgs) throws Exception {
this.asyncEnabled = true;
}

if (line.hasOption("proxy")) {
this.useProxyClient = true;
}

args.readPolicy = clientPolicy.readPolicyDefault;
args.writePolicy = clientPolicy.writePolicyDefault;
args.batchPolicy = clientPolicy.batchPolicyDefault;
Expand All @@ -412,13 +404,6 @@ public Main(String[] commandLineArgs) throws Exception {
this.port = 3000;
}

// If the Aerospike server's default port (3000) is used and the proxy client is used,
// Reset the port to the proxy server's default port (4000).
if (port == 3000 && useProxyClient) {
System.out.println("Change proxy server port to 4000");
port = 4000;
}

if (line.hasOption("hosts")) {
this.hosts = Host.parseHosts(line.getOptionValue("hosts"), this.port);
}
Expand Down Expand Up @@ -1183,16 +1168,6 @@ public void runBenchmarks() throws Exception {
eventPolicy.minTimeout = args.writePolicy.socketTimeout;
}

if (this.useProxyClient && this.eventLoopType == EventLoopType.DIRECT_NIO) {
// Proxy client requires netty event loops.
if (Epoll.isAvailable()) {
this.eventLoopType = EventLoopType.NETTY_EPOLL;
}
else {
this.eventLoopType = EventLoopType.NETTY_NIO;
}
}

switch (this.eventLoopType) {
default:
case DIRECT_NIO: {
Expand Down Expand Up @@ -1232,7 +1207,7 @@ public void runBenchmarks() throws Exception {
clientPolicy.asyncMaxConnsPerNode = this.asyncMaxCommands;
}

IAerospikeClient client = AerospikeClientFactory.getClient(clientPolicy, useProxyClient, hosts);
IAerospikeClient client = new AerospikeClient(clientPolicy, hosts);

try {
if (initialize) {
Expand All @@ -1252,7 +1227,7 @@ public void runBenchmarks() throws Exception {
}
}
else {
IAerospikeClient client = AerospikeClientFactory.getClient(clientPolicy, useProxyClient, hosts);
IAerospikeClient client = new AerospikeClient(clientPolicy, hosts);

try {
if (initialize) {
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>8.1.4</version>
<version>9.0.0</version>
</parent>
<artifactId>aerospike-client-jdk21</artifactId>
<packaging>jar</packaging>
Expand Down
34 changes: 34 additions & 0 deletions client/src/com/aerospike/client/AbortStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2012-2024 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.aerospike.client;

/**
* Multi-record transaction (MRT) abort status code.
*/
public enum AbortStatus {
OK("Abort succeeded"),
ALREADY_COMMITTED("Already committed"),
ALREADY_ABORTED("Already aborted"),
ROLL_BACK_ABANDONED("MRT client roll back abandoned. Server will eventually abort the MRT."),
CLOSE_ABANDONED("MRT has been rolled back, but MRT client close was abandoned. Server will eventually close the MRT.");

public final String str;

AbortStatus(String str) {
this.str = str;
}
}
Loading

0 comments on commit 3977e29

Please sign in to comment.