Skip to content

Commit

Permalink
Merge pull request #354 from aerospike/stage-jdk8
Browse files Browse the repository at this point in the history
Java Client 9.0.1 for JDK8
  • Loading branch information
BrianNichols authored Dec 3, 2024
2 parents 8ad8d32 + b747cd9 commit 8407023
Show file tree
Hide file tree
Showing 21 changed files with 393 additions and 155 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.0</version>
<version>9.0.1</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.0</version>
<version>9.0.1</version>
</parent>
<artifactId>aerospike-client-jdk8</artifactId>
<packaging>jar</packaging>
Expand Down
148 changes: 114 additions & 34 deletions client/src/com/aerospike/client/AerospikeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,154 +367,176 @@ protected AerospikeClient(ClientPolicy policy) {
//-------------------------------------------------------

/**
* Copy read policy default to avoid problems if this shared instance is later modified.
* Return read policy default. Use when the policy will not be modified.
*/
public final Policy getReadPolicyDefault() {
return new Policy(readPolicyDefault);
return readPolicyDefault;
}

/**
* Copy read policy default.
* Copy read policy default. Use when the policy will be modified for use in a specific command.
*/
public final Policy copyReadPolicyDefault() {
return new Policy(readPolicyDefault);
}

/**
* Copy write policy default to avoid problems if this shared instance is later modified.
* Return write policy default. Use when the policy will not be modified.
*/
public final WritePolicy getWritePolicyDefault() {
return new WritePolicy(writePolicyDefault);
return writePolicyDefault;
}

/**
* Copy write policy default.
* Copy write policy default. Use when the policy will be modified for use in a specific command.
*/
public final WritePolicy copyWritePolicyDefault() {
return new WritePolicy(writePolicyDefault);
}

/**
* Copy scan policy default to avoid problems if this shared instance is later modified.
* Return scan policy default. Use when the policy will not be modified.
*/
public final ScanPolicy getScanPolicyDefault() {
return new ScanPolicy(scanPolicyDefault);
return scanPolicyDefault;
}

/**
* Copy scan policy default.
* Copy scan policy default. Use when the policy will be modified for use in a specific command.
*/
public final ScanPolicy copyScanPolicyDefault() {
return new ScanPolicy(scanPolicyDefault);
}

/**
* Copy query policy default to avoid problems if this shared instance is later modified.
* Return query policy default. Use when the policy will not be modified.
*/
public final QueryPolicy getQueryPolicyDefault() {
return new QueryPolicy(queryPolicyDefault);
return queryPolicyDefault;
}

/**
* Copy query policy default.
* Copy query policy default. Use when the policy will be modified for use in a specific command.
*/
public final QueryPolicy copyQueryPolicyDefault() {
return new QueryPolicy(queryPolicyDefault);
}

/**
* Copy batch header read policy default to avoid problems if this shared instance is later modified.
* Return batch header read policy default. Use when the policy will not be modified.
*/
public final BatchPolicy getBatchPolicyDefault() {
return new BatchPolicy(batchPolicyDefault);
return batchPolicyDefault;
}

/**
* Copy batch header read policy default.
* Copy batch header read policy default. Use when the policy will be modified for use in a
* specific command.
*/
public final BatchPolicy copyBatchPolicyDefault() {
return new BatchPolicy(batchPolicyDefault);
}

/**
* Copy batch header write policy default to avoid problems if this shared instance is later modified.
* Return batch header write policy default. Use when the policy will not be modified.
*/
public final BatchPolicy getBatchParentPolicyWriteDefault() {
return new BatchPolicy(batchParentPolicyWriteDefault);
return batchParentPolicyWriteDefault;
}

/**
* Copy batch header write policy default.
* Copy batch header write policy default. Use when the policy will be modified for use in a
* specific command.
*/
public final BatchPolicy copyBatchParentPolicyWriteDefault() {
return new BatchPolicy(batchParentPolicyWriteDefault);
}

/**
* Copy batch detail write policy default to avoid problems if this shared instance is later modified.
* Return batch detail write policy default. Use when the policy will not be modified.
*/
public final BatchWritePolicy getBatchWritePolicyDefault() {
return new BatchWritePolicy(batchWritePolicyDefault);
return batchWritePolicyDefault;
}

/**
* Copy batch detail write policy default.
* Copy batch detail write policy default. Use when the policy will be modified for use in a
* specific command.
*/
public final BatchWritePolicy copyBatchWritePolicyDefault() {
return new BatchWritePolicy(batchWritePolicyDefault);
}

/**
* Copy batch detail delete policy default to avoid problems if this shared instance is later modified.
* Return batch detail delete policy default. Use when the policy will not be modified.
*/
public final BatchDeletePolicy getBatchDeletePolicyDefault() {
return new BatchDeletePolicy(batchDeletePolicyDefault);
return batchDeletePolicyDefault;
}

/**
* Copy batch detail delete policy default.
* Copy batch detail delete policy default. Use when the policy will be modified for use in a
* specific command.
*/
public final BatchDeletePolicy copyBatchDeletePolicyDefault() {
return new BatchDeletePolicy(batchDeletePolicyDefault);
}

/**
* Copy batch detail UDF policy default to avoid problems if this shared instance is later modified.
* Return batch detail UDF policy default. Use when the policy will not be modified.
*/
public final BatchUDFPolicy getBatchUDFPolicyDefault() {
return new BatchUDFPolicy(batchUDFPolicyDefault);
return batchUDFPolicyDefault;
}

/**
* Copy batch detail UDF policy default.
* Copy batch detail UDF policy default. Use when the policy will be modified for use in a
* specific command.
*/
public final BatchUDFPolicy copyBatchUDFPolicyDefault() {
return new BatchUDFPolicy(batchUDFPolicyDefault);
}

/**
* Copy info command policy default to avoid problems if this shared instance is later modified.
* Return info command policy default. Use when the policy will not be modified.
*/
public final InfoPolicy getInfoPolicyDefault() {
return new InfoPolicy(infoPolicyDefault);
return infoPolicyDefault;
}

/**
* Copy info command policy default.
* Copy info command policy default. Use when the policy will be modified for use in a
* specific command.
*/
public final InfoPolicy copyInfoPolicyDefault() {
return new InfoPolicy(infoPolicyDefault);
}

/**
* Copy MRT record version verify policy default.
* Return MRT record version verify policy default. Use when the policy will not be modified.
*/
public final TxnVerifyPolicy getTxnVerifyPolicyDefault() {
return txnVerifyPolicyDefault;
}

/**
* Copy MRT record version verify policy default. Use when the policy will be modified for use
* in a specific command.
*/
public final TxnVerifyPolicy copyTxnVerifyPolicyDefault() {
return new TxnVerifyPolicy(txnVerifyPolicyDefault);
}

/**
* Copy MRT roll forward/back policy default.
* Return MRT roll forward/back policy default. Use when the policy will not be modified.
*/
public final TxnRollPolicy getTxnRollPolicyDefault() {
return txnRollPolicyDefault;
}

/**
* Copy MRT roll forward/back policy default. Use when the policy will be modified for use
* in a specific command.
*/
public final TxnRollPolicy copyTxnRollPolicyDefault() {
return new TxnRollPolicy(txnRollPolicyDefault);
Expand Down Expand Up @@ -1313,7 +1335,8 @@ public final void truncate(InfoPolicy policy, String ns, String set, Calendar be

/**
* Reset record's time to expiration using the policy's expiration.
* Fail if the record does not exist.
* If the record does not exist, it can't be created because the server deletes empty records.
* Throw an exception if the record does not exist.
*
* @param policy write configuration parameters, pass in null for defaults
* @param key unique record identifier
Expand All @@ -1329,12 +1352,14 @@ public final void touch(WritePolicy policy, Key key)
TxnMonitor.addKey(cluster, policy, key);
}

TouchCommand command = new TouchCommand(cluster, policy, key);
TouchCommand command = new TouchCommand(cluster, policy, key, true);
command.execute();
}

/**
* Asynchronously reset record's time to expiration using the policy's expiration.
* If the record does not exist, it can't be created because the server deletes empty records.
* <p>
* This method registers the command with an event loop and returns.
* The event loop thread will process the command and send the results to the listener.
* <p>
Expand All @@ -1361,6 +1386,61 @@ public final void touch(EventLoop eventLoop, WriteListener listener, WritePolicy
AsyncTxnMonitor.execute(eventLoop, cluster, policy, command);
}

/**
* Reset record's time to expiration using the policy's expiration.
* If the record does not exist, it can't be created because the server deletes empty records.
* Return true if the record exists and is touched. Return false if the record does not exist.
*
* @param policy write configuration parameters, pass in null for defaults
* @param key unique record identifier
* @throws AerospikeException if touch fails
*/
public final boolean touched(WritePolicy policy, Key key)
throws AerospikeException {
if (policy == null) {
policy = writePolicyDefault;
}

if (policy.txn != null) {
TxnMonitor.addKey(cluster, policy, key);
}

TouchCommand command = new TouchCommand(cluster, policy, key, false);
command.execute();
return command.getTouched();
}

/**
* Asynchronously reset record's time to expiration using the policy's expiration.
* If the record does not exist, it can't be created because the server deletes empty records.
* <p>
* This method registers the command with an event loop and returns.
* The event loop thread will process the command and send the results to the listener.
* <p>
* If the record does not exist, send a value of false to
* {@link com.aerospike.client.listener.ExistsListener#onSuccess(Key, boolean)}
*
* @param eventLoop event loop that will process the command. If NULL, the event
* loop will be chosen by round-robin.
* @param listener where to send results, pass in null for fire and forget
* @param policy write configuration parameters, pass in null for defaults
* @param key unique record identifier
* @throws AerospikeException if event loop registration fails
*/
public final void touched(EventLoop eventLoop, ExistsListener listener, WritePolicy policy, Key key)
throws AerospikeException {
if (eventLoop == null) {
eventLoop = cluster.eventLoops.next();
}

if (policy == null) {
policy = writePolicyDefault;
}

AsyncTouch command = new AsyncTouch(cluster, listener, policy, key);
AsyncTxnMonitor.execute(eventLoop, cluster, policy, command);
}

//-------------------------------------------------------
// Existence-Check Operations
//-------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion client/src/com/aerospike/client/AerospikeException.java
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public Backoff(int resultCode) {
}

/**
* Exception thrown when {@link AerospikeClient#commit(com.aerospike.client.Tran)} fails.
* Exception thrown when a multi-record transaction commit fails.
*/
public static final class Commit extends AerospikeException {
private static final long serialVersionUID = 1L;
Expand Down
Loading

0 comments on commit 8407023

Please sign in to comment.