Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions driver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>d-MMMM-yyyy</maven.build.timestamp.format>
<copyright>Copyright (c) 2011, 2025 Oracle and/or its affiliates. All rights reserved.</copyright>
Expand Down Expand Up @@ -274,8 +274,8 @@
<version>3.11.0</version>
<configuration>
<fork>true</fork>
<source>1.8</source>
<target>1.8</target>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgument>-Xlint:all</compilerArgument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import io.netty.handler.codec.http.HttpHeaders;
import oracle.nosql.driver.ops.Request;

import java.util.concurrent.CompletableFuture;

/**
* A callback interface used by the driver to obtain an authorization string
* for a request. {@link NoSQLHandle} calls this interface when and
Expand All @@ -34,6 +36,21 @@ public interface AuthorizationProvider {
*/
public String getAuthorizationString(Request request);

/**
* Returns an authorization string for specified request. This is sent to
* the server in the request for authorization. Authorization information
* can be request-dependent.
*
* @param request the request being processed
*
* @return a CompletableFuture of a string indicating that the application
* is authorized to perform the request
*/
public default CompletableFuture<String>
getAuthorizationStringAsync(Request request) {
return CompletableFuture.completedFuture(null);
}

/**
* Release resources provider is using.
*/
Expand Down Expand Up @@ -75,6 +92,27 @@ public default void setRequiredHeaders(String authString,
}
}

/**
* Set HTTP headers required by the provider asynchronously.
*
* @param authString the authorization string for the request
*
* @param request the request being processed
*
* @param headers the HTTP headers
*
* @param content the request content bytes
*/
default CompletableFuture<Void> setRequiredHeadersAsync(String authString,
Request request,
HttpHeaders headers,
byte[] content) {
if (authString != null) {
headers.set(AUTHORIZATION, authString);
}
return CompletableFuture.completedFuture(null);
}

/**
* Invalidate any cached authorization strings.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ public void delay(Request request,
request.addRetryDelayMs(delayMs);
}

@Override
public int delayTime(Request request,
int numRetries,
RetryableException re) {
return Math.max(0, computeBackoffDelay(request, fixedDelayMs));
}

/**
* Compute an incremental backoff delay in milliseconds.
* This method also checks the request's timeout and ensures the
Expand Down
Loading