Class AutoRebuildSslContextProvider
- java.lang.Object
-
- com.github.fmjsjx.libnetty.handler.ssl.AutoRebuildSslContextProvider
-
- All Implemented Interfaces:
SslContextProvider,java.io.Closeable,java.lang.AutoCloseable,java.util.function.Supplier<io.netty.handler.ssl.SslContext>
public abstract class AutoRebuildSslContextProvider extends java.lang.Object implements SslContextProvider
The abstract implementation forSslContextProviderwith aWatchServiceto auto-rebuildSSLContextwhen certificates modified.- Since:
- 1.1
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAutoRebuildSslContextProvider(SslContextProvider factory, java.nio.file.Path dir, java.lang.String... watchingFiles)Constructs a newAutoRebuildSslContextProviderwith the specified directoryPathand watching files given.protectedAutoRebuildSslContextProvider(SslContextProvider factory, java.nio.file.Path dir, java.util.Collection<java.lang.String> watchingFiles)Constructs a newAutoRebuildSslContextProviderwith the specified directoryPathand watching files given.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close this provider and releases any system resources associated with it.io.netty.handler.ssl.SslContextget()Returns theSslContextinstance.java.nio.file.PathgetDir()Returns thePathof the watching directory.booleanisClosed()java.util.stream.Stream<java.nio.file.Path>resolvedWatchingFiles()Returns aStreamcontains the resolved path of each watching files.java.util.Set<java.lang.String>watchingFiles()Returns the set contains the name of each watching files.
-
-
-
Constructor Detail
-
AutoRebuildSslContextProvider
protected AutoRebuildSslContextProvider(SslContextProvider factory, java.nio.file.Path dir, java.util.Collection<java.lang.String> watchingFiles) throws SSLRuntimeException, java.io.IOException
Constructs a newAutoRebuildSslContextProviderwith the specified directoryPathand watching files given.- Parameters:
factory- a factory to createSslContextsdir- the path of the parent directorywatchingFiles- the collection contains the name of each watching files- Throws:
SSLRuntimeException- if any SSL error occursjava.io.IOException- if an I/O error occurs
-
AutoRebuildSslContextProvider
protected AutoRebuildSslContextProvider(SslContextProvider factory, java.nio.file.Path dir, java.lang.String... watchingFiles) throws SSLRuntimeException, java.io.IOException
Constructs a newAutoRebuildSslContextProviderwith the specified directoryPathand watching files given.- Parameters:
factory- a factory to createSslContextsdir- the path of the parent directorywatchingFiles- the array contains the name of each watching files- Throws:
SSLRuntimeException- if any SSL error occursjava.io.IOException- if an I/O error occurs
-
-
Method Detail
-
getDir
public java.nio.file.Path getDir()
Returns thePathof the watching directory.- Returns:
- the path of the watching directory
-
watchingFiles
public java.util.Set<java.lang.String> watchingFiles()
Returns the set contains the name of each watching files.- Returns:
- the set contains the name of each watching file
-
resolvedWatchingFiles
public java.util.stream.Stream<java.nio.file.Path> resolvedWatchingFiles()
Returns aStreamcontains the resolved path of each watching files.- Returns:
- a
Stream<Path>
-
get
public io.netty.handler.ssl.SslContext get()
Description copied from interface:SslContextProviderReturns theSslContextinstance.- Specified by:
getin interfaceSslContextProvider- Specified by:
getin interfacejava.util.function.Supplier<io.netty.handler.ssl.SslContext>- Returns:
- a
SslContext
-
isClosed
public boolean isClosed()
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:SslContextProviderClose this provider and releases any system resources associated with it.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceSslContextProvider- Throws:
java.io.IOException- if an I/O error occurs
-
-