Class CachingSSLContextFactory
- java.lang.Object
-
- org.apache.activemq.artemis.core.remoting.impl.ssl.DefaultSSLContextFactory
-
- org.apache.activemq.artemis.core.remoting.impl.ssl.CachingSSLContextFactory
-
- All Implemented Interfaces:
Comparable<SSLContextFactory>,SSLContextFactory
public class CachingSSLContextFactory extends DefaultSSLContextFactory
SSLContextFactoryproviding a cache ofSSLContext. SinceSSLContextshould be reused instead of recreated and are thread safe. To activate it you need to allow this Service to be discovered by having aMETA-INF/services/org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextFactoryfile withorg.apache.activemq.artemis.core.remoting.impl.ssl.CachingSSLContextFactoryas value.
-
-
Field Summary
-
Fields inherited from interface org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextFactory
log
-
-
Constructor Summary
Constructors Constructor Description CachingSSLContextFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearSSLContexts()protected ObjectgetCacheKey(SSLContextConfig config, Map<String,Object> additionalOpts)Obtains/calculates a cache key for the correspondingSslContext.intgetPriority()The priority for the SSLContextFactory when resolving the service to get the implementation.SSLContextgetSSLContext(SSLContextConfig config, Map<String,Object> additionalOpts)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextFactory
compareTo, getSSLContext
-
-
-
-
Method Detail
-
clearSSLContexts
public void clearSSLContexts()
-
getSSLContext
public SSLContext getSSLContext(SSLContextConfig config, Map<String,Object> additionalOpts) throws Exception
- Specified by:
getSSLContextin interfaceSSLContextFactory- Overrides:
getSSLContextin classDefaultSSLContextFactoryadditionalOpts- implementation specific additional options.- Returns:
- an
SSLContextfor the given configuration. - Throws:
Exception
-
getCacheKey
protected Object getCacheKey(SSLContextConfig config, Map<String,Object> additionalOpts)
Obtains/calculates a cache key for the correspondingSslContext.- If
configcontains an entry with key "sslContext", the associated value is returned - Otherwise, the provided
SSLContextConfigis used as cache key.
- Returns:
- the SSL context name to cache/retrieve the
SslContext.
- If
-
getPriority
public int getPriority()
Description copied from interface:SSLContextFactoryThe priority for the SSLContextFactory when resolving the service to get the implementation. This is used when selecting the implementation when several implementations are loaded. The highest priority implementation will be used.- Specified by:
getPriorityin interfaceSSLContextFactory- Overrides:
getPriorityin classDefaultSSLContextFactory- Returns:
- the priority.
-
-