Skip to content

Commit

Permalink
Merge pull request #350 from aerospike/stage-jdk8
Browse files Browse the repository at this point in the history
Java Client 9.0.0 for JDK8
  • Loading branch information
BrianNichols authored Nov 19, 2024
2 parents b2d87cb + 6bd2157 commit 8ad8d32
Show file tree
Hide file tree
Showing 171 changed files with 6,538 additions and 12,038 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
53 changes: 21 additions & 32 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-jdk8</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 @@ -66,40 +61,34 @@
<artifactId>maven-compiler-plugin</artifactId>
</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>
41 changes: 8 additions & 33 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 asyncEnabled;
private boolean initialize;
private boolean batchShowNodes;
Expand Down Expand Up @@ -352,13 +350,11 @@ 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");
options.addOption("sendKey", false, "Send key to server");

options.addOption("pids", "partitionIds", true, "Specify the list of comma seperated partition IDs the primary keys must belong to");

// parse the command line arguments
Expand All @@ -385,10 +381,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 @@ -415,13 +407,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 @@ -999,12 +984,12 @@ else if (! level.equals("all")) {
if (line.hasOption("sendKey")) {
args.writePolicy.sendKey = true;
}

if (line.hasOption("partitionIds")) {
String[] pids = line.getOptionValue("partitionIds").split(",");

Set<Integer> partitionIds = new HashSet<>();

for (String pid : pids) {
int partitionId = -1;

Expand All @@ -1021,7 +1006,7 @@ else if (! level.equals("all")) {

partitionIds.add(partitionId);
}

args.partitionIds = partitionIds;
}

Expand Down Expand Up @@ -1180,16 +1165,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 @@ -1229,7 +1204,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 @@ -1249,7 +1224,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-jdk8</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 8ad8d32

Please sign in to comment.