Class FileWatcherCertificateProvider
java.lang.Object
io.grpc.xds.internal.security.certprovider.CertificateProvider
io.grpc.xds.internal.security.certprovider.FileWatcherCertificateProvider
- All Implemented Interfaces:
Closeable
,Closeable
,AutoCloseable
,Runnable
Implementation of
CertificateProvider
for file watching cert provider.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
Nested classes/interfaces inherited from class io.grpc.xds.internal.security.certprovider.CertificateProvider
CertificateProvider.DistributorWatcher, CertificateProvider.Watcher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Path
private final Path
private FileTime
private FileTime
private FileTime
private static final Logger
private final long
private final ScheduledExecutorService
(package private) ScheduledFuture
<?> private boolean
private final io.grpc.internal.TimeProvider
private final Path
-
Constructor Summary
ConstructorsConstructorDescriptionFileWatcherCertificateProvider
(CertificateProvider.DistributorWatcher watcher, boolean notifyCertUpdates, String certFile, String keyFile, String trustFile, long refreshIntervalInSeconds, ScheduledExecutorService scheduledExecutorService, io.grpc.internal.TimeProvider timeProvider) -
Method Summary
Modifier and TypeMethodDescription(package private) void
void
close()
Releases all resources and stop cert refreshes and watcher updates.private long
private void
void
run()
private void
scheduleNextRefreshCertificate
(long delayInSeconds) void
start()
Starts the cert refresh and watcher update cycle.Methods inherited from class io.grpc.xds.internal.security.certprovider.CertificateProvider
getWatcher, isNotifyCertUpdates
-
Field Details
-
logger
-
scheduledExecutorService
-
timeProvider
private final io.grpc.internal.TimeProvider timeProvider -
certFile
-
keyFile
-
trustFile
-
refreshIntervalInSeconds
private final long refreshIntervalInSeconds -
scheduledFuture
ScheduledFuture<?> scheduledFuture -
lastModifiedTimeCert
-
lastModifiedTimeKey
-
lastModifiedTimeRoot
-
shutdown
private boolean shutdown
-
-
Constructor Details
-
FileWatcherCertificateProvider
FileWatcherCertificateProvider(CertificateProvider.DistributorWatcher watcher, boolean notifyCertUpdates, String certFile, String keyFile, String trustFile, long refreshIntervalInSeconds, ScheduledExecutorService scheduledExecutorService, io.grpc.internal.TimeProvider timeProvider)
-
-
Method Details
-
start
public void start()Description copied from class:CertificateProvider
Starts the cert refresh and watcher update cycle.- Specified by:
start
in classCertificateProvider
-
close
public void close()Description copied from class:CertificateProvider
Releases all resources and stop cert refreshes and watcher updates.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classCertificateProvider
-
scheduleNextRefreshCertificate
private void scheduleNextRefreshCertificate(long delayInSeconds) -
checkAndReloadCertificates
void checkAndReloadCertificates() -
generateErrorIfCurrentCertExpired
-
computeDelaySecondsToCertExpiry
-
run
public void run()
-