Class 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 for SslContextProvider with a WatchService to auto-rebuild SSLContext when certificates modified.
    Since:
    1.1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close this provider and releases any system resources associated with it.
      io.netty.handler.ssl.SslContext get()
      Returns the SslContext instance.
      java.nio.file.Path getDir()
      Returns the Path of the watching directory.
      boolean isClosed()  
      java.util.stream.Stream<java.nio.file.Path> resolvedWatchingFiles()
      Returns a Stream contains the resolved path of each watching files.
      java.util.Set<java.lang.String> watchingFiles()
      Returns the set contains the name of each watching files.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 new AutoRebuildSslContextProvider with the specified directory Path and watching files given.
        Parameters:
        factory - a factory to create SslContexts
        dir - the path of the parent directory
        watchingFiles - the collection contains the name of each watching files
        Throws:
        SSLRuntimeException - if any SSL error occurs
        java.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 new AutoRebuildSslContextProvider with the specified directory Path and watching files given.
        Parameters:
        factory - a factory to create SslContexts
        dir - the path of the parent directory
        watchingFiles - the array contains the name of each watching files
        Throws:
        SSLRuntimeException - if any SSL error occurs
        java.io.IOException - if an I/O error occurs
    • Method Detail

      • getDir

        public java.nio.file.Path getDir()
        Returns the Path of 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 a Stream contains the resolved path of each watching files.
        Returns:
        a Stream<Path>
      • get

        public io.netty.handler.ssl.SslContext get()
        Description copied from interface: SslContextProvider
        Returns the SslContext instance.
        Specified by:
        get in interface SslContextProvider
        Specified by:
        get in interface java.util.function.Supplier<io.netty.handler.ssl.SslContext>
        Returns:
        a SslContext
      • isClosed

        public boolean isClosed()
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: SslContextProvider
        Close this provider and releases any system resources associated with it.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface SslContextProvider
        Throws:
        java.io.IOException - if an I/O error occurs