[ 
https://issues.apache.org/jira/browse/DIRMINA-325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lecharny closed DIRMINA-325.
-------------------------------------


> Configuration of SSLSession cacheSize and sessionTimeout
> --------------------------------------------------------
>
>                 Key: DIRMINA-325
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-325
>             Project: MINA
>          Issue Type: Improvement
>          Components: Integration
>    Affects Versions: 1.0.0
>            Reporter: Wolter Eldering
>            Assignee: Niklas Therning
>             Fix For: 2.0.0-M1
>
>
> The defaults values for session cache and timeout could lead to a large 
> number of sessions being cached under a SSLContext.
> The is no way to set these values in SSLContextFactoryBean.
> Index: 
> integration-spring/src/main/java/org/apache/mina/integration/spring/ssl/SSLContextFactoryBean.java
> ===================================================================
> --- 
> integration-spring/src/main/java/org/apache/mina/integration/spring/ssl/SSLContextFactoryBean.java
>   (revision 487691)
> +++ 
> integration-spring/src/main/java/org/apache/mina/integration/spring/ssl/SSLContextFactoryBean.java
>   (working copy)
> @@ -76,6 +76,10 @@
>      private String trustManagerFactoryProvider = null;
>      private boolean trustManagerFactoryAlgorithmUseDefault = false;
>      private ManagerFactoryParameters trustManagerFactoryParameters = null;
> +    private int clientSessionCacheSize = -1;
> +    private int clientSessionTimeout = -1;
> +    private int serverSessionCacheSize = -1;
> +    private int serverSessionTimeout = -1;
>      
>      protected Object createInstance() throws Exception
>      {
> @@ -156,7 +160,27 @@
>          }
>          
>          context.init( keyManagers, trustManagers, secureRandom );
> +
> +        if( clientSessionCacheSize >= 0 )
> +        {
> +            context.getClientSessionContext().setSessionCacheSize( 
> clientSessionCacheSize );
> +        }
>          
> +        if( clientSessionTimeout >= 0 )
> +        {
> +            context.getClientSessionContext().setSessionTimeout( 
> clientSessionTimeout );
> +        }
> +        
> +        if( serverSessionCacheSize >= 0 )
> +        {
> +            context.getServerSessionContext().setSessionCacheSize( 
> serverSessionCacheSize );
> +        }
> +        
> +        if( serverSessionTimeout >= 0 )
> +        {
> +            context.getServerSessionContext().setSessionTimeout( 
> serverSessionTimeout );
> +        }
> +        
>          return context;
>      }
>  
> @@ -393,5 +417,47 @@
>          this.secureRandom = secureRandom;
>      }
>  
> +    /**
> +     * Sets the SSLSession cache size for the {...@link SSLSessionContext} 
> for use in client mode.
> +     *  
> +     * @param size the new session cache size limit; zero means there is no 
> limit.
> +     * @see SSLSessionContext#setSessionCacheSize(int size)
> +     */
> +    public void setClientSessionCacheSize(int size)
> +    {
> +        this.clientSessionCacheSize = size;
> +       }
>      
> +    /**
> +     * Set the SSLSession timeout limit for the {...@link SSLSessionContext} 
> for use in client mode.
> +     * 
> +     * @param seconds the new session timeout limit in seconds; zero means 
> there is no limit.
> +     * @see SSLSessionContext#setSessionTimeout(int seconds)
> +     */
> +    public void setClientSessionTimeout(int seconds)
> +    {
> +        this.clientSessionTimeout = seconds;
> +       }
> +
> +    /**
> +     * Sets the SSLSession cache size for the {...@link SSLSessionContext} 
> for use in server mode.
> +     *  
> +     * @param size the new session cache size limit; zero means there is no 
> limit.
> +     * @see SSLSessionContext#setSessionCacheSize(int size)
> +     */
> +    public void setServerSessionCacheSize(int serverSessionCacheSize)
> +    {
> +        this.serverSessionCacheSize = serverSessionCacheSize;
> +       }
> +
> +    /**
> +     * Set the SSLSession timeout limit for the {...@link SSLSessionContext} 
> for use in server mode.
> +     * 
> +     * @param seconds the new session timeout limit in seconds; zero means 
> there is no limit.
> +     * @see SSLSessionContext#setSessionTimeout(int seconds)
> +     */
> +    public void setServerSessionTimeout(int serverSessionTimeout)
> +    {
> +        this.serverSessionTimeout = serverSessionTimeout;
> +       }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to