Skip to content

Commit

Permalink
Style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
erm-g committed Jul 8, 2024
1 parent 940e7be commit 7a7b3a3
Showing 1 changed file with 30 additions and 29 deletions.
59 changes: 30 additions & 29 deletions util/src/main/java/io/grpc/util/AdvancedTlsX509KeyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public void updateIdentityCredentials(PrivateKey key, X509Certificate[] certs) {
/**
* Updates the current cached private key and cert chains.
*
* @param key the private key that is going to be used
* @param certs the certificate chain that is going to be used
* @param key the private key that is going to be used
*/
public void updateIdentityCredentials(X509Certificate[] certs, PrivateKey key,) {
public void updateIdentityCredentials(X509Certificate[] certs, PrivateKey key) {
this.keyInfo = new KeyInfo(checkNotNull(key, "key"), checkNotNull(certs, "certs"));
}

Expand All @@ -130,7 +130,7 @@ public void updateIdentityCredentials(X509Certificate[] certs, PrivateKey key,)
* @param keyFile the file on disk holding the private key
* @param period the period between successive read-and-update executions
* @param unit the time unit of the initialDelay and period parameters
* @param executor the execute service we use to read and update the credentials
* @param executor the executor service we use to read and update the credentials
* @return an object that caller should close when the file refreshes are not needed
*/
public Closeable updateIdentityCredentials(File certFile, File keyFile,
Expand All @@ -154,32 +154,6 @@ public Closeable updateIdentityCredentials(File certFile, File keyFile,
return () -> future.cancel(false);
}

/**
* Schedules a {@code ScheduledExecutorService} to read private key and certificate chains from
* the local file paths periodically, and update the cached identity credentials if they are both
* updated. You must close the returned Closeable before calling this method again or other update
* methods ({@link AdvancedTlsX509KeyManager#updateIdentityCredentials}, {@link
* AdvancedTlsX509KeyManager#updateIdentityCredentials(File, File)}).
* Before scheduling the task, the method synchronously executes {@code readAndUpdate} once. The
* minimum refresh period of 1 minute is enforced.
*
* @param keyFile the file on disk holding the private key
* @param certFile the file on disk holding the certificate chain
* @param period the period between successive read-and-update executions
* @param unit the time unit of the initialDelay and period parameters
* @param executor the execute service we use to read and update the credentials
* @return an object that caller should close when the file refreshes are not needed
* @deprecated Use {@link
* #updateIdentityCredentials(File, File, long, TimeUnit, ScheduledExecutorService)} instead.
*/
@Deprecated
@InlineMe(replacement = "this.updateIdentityCredentials(certFile, keyFile, period, unit, executor)")
public Closeable updateIdentityCredentialsFromFile(File keyFile, File certFile,
long period, TimeUnit unit, ScheduledExecutorService executor) throws IOException,
GeneralSecurityException {
return updateIdentityCredentials(certFile, keyFile, period, unit, executor);
}

/**
* Updates certificate chains and the private key from the local file paths.
*
Expand Down Expand Up @@ -209,6 +183,33 @@ public void updateIdentityCredentialsFromFile(File keyFile, File certFile) throw
updateIdentityCredentials(certFile, keyFile);
}

/**
* Schedules a {@code ScheduledExecutorService} to read private key and certificate chains from
* the local file paths periodically, and update the cached identity credentials if they are both
* updated. You must close the returned Closeable before calling this method again or other update
* methods ({@link AdvancedTlsX509KeyManager#updateIdentityCredentials}, {@link
* AdvancedTlsX509KeyManager#updateIdentityCredentials(File, File)}).
* Before scheduling the task, the method synchronously executes {@code readAndUpdate} once. The
* minimum refresh period of 1 minute is enforced.
*
* @param keyFile the file on disk holding the private key
* @param certFile the file on disk holding the certificate chain
* @param period the period between successive read-and-update executions
* @param unit the time unit of the initialDelay and period parameters
* @param executor the executor service we use to read and update the credentials
* @return an object that caller should close when the file refreshes are not needed
* @deprecated Use {@link
* #updateIdentityCredentials(File, File, long, TimeUnit, ScheduledExecutorService)} instead.
*/
@Deprecated
@InlineMe(replacement =
"this.updateIdentityCredentials(certFile, keyFile, period, unit, executor)")
public Closeable updateIdentityCredentialsFromFile(File keyFile, File certFile,
long period, TimeUnit unit, ScheduledExecutorService executor) throws IOException,
GeneralSecurityException {
return updateIdentityCredentials(certFile, keyFile, period, unit, executor);
}

private static class KeyInfo {
// The private key and the cert chain we will use to send to peers to prove our identity.
final PrivateKey key;
Expand Down

0 comments on commit 7a7b3a3

Please sign in to comment.