Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0.0
-
None
Description
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 )
+
+ if( clientSessionTimeout >= 0 )
+
+
+ if( serverSessionCacheSize >= 0 )
+
+
+ if( serverSessionTimeout >= 0 )
+
+
return context;
}
@@ -393,5 +417,47 @@
this.secureRandom = secureRandom;
}
+ /**
+ * Sets the SSLSession cache size for the
+ *
+ * @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)
+
+
+ /**
+ * Sets the SSLSession cache size for the
+ *
+ * @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)
+
}