Author: markt
Date: Wed Feb 13 21:23:51 2013
New Revision: 1445935
URL: http://svn.apache.org/r1445935
Log:
Implement getters and setters for session idle timeout.
The actual timeout mechanism is still TODO
Modified:
tomcat/trunk/java/javax/websocket/Session.java
tomcat/trunk/java/javax/websocket/WebSocketContainer.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
Modified: tomcat/trunk/java/javax/websocket/Session.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/Session.java?rev=1445935&r1=1445934&r2=1445935&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/Session.java (original)
+++ tomcat/trunk/java/javax/websocket/Session.java Wed Feb 13 21:23:51 2013
@@ -48,8 +48,16 @@ public interface Session extends Closeab
boolean isOpen();
+ /**
+ * Get the idle timeout for this session in milliseconds. Zero or negative
+ * values indicate an infinite timeout.
+ */
long getTimeout();
+ /**
+ * Set the idle timeout for this session in milliseconds. Zero or negative
+ * values indicate an infinite timeout.
+ */
void setTimeout(long seconds);
/**
Modified: tomcat/trunk/java/javax/websocket/WebSocketContainer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/WebSocketContainer.java?rev=1445935&r1=1445934&r2=1445935&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/WebSocketContainer.java (original)
+++ tomcat/trunk/java/javax/websocket/WebSocketContainer.java Wed Feb 13
21:23:51 2013
@@ -55,8 +55,16 @@ public interface WebSocketContainer {
ClientEndpointConfiguration clientEndpointConfiguration, URI path)
throws DeploymentException;
+ /**
+ * Get the current default session idle timeout in milliseconds. Zero or
+ * negative values indicate an infinite timeout.
+ */
long getMaxSessionIdleTimeout();
+ /**
+ * Set the current default session idle timeout in milliseconds. Zero or
+ * negative values indicate an infinite timeout.
+ */
void setMaxSessionIdleTimeout(long timeout);
/**
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1445935&r1=1445934&r2=1445935&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java Wed Feb 13
21:23:51 2013
@@ -63,6 +63,7 @@ public class WsSession implements Sessio
Constants.DEFAULT_BUFFER_SIZE;
private volatile int maxTextMessageBufferSize =
Constants.DEFAULT_BUFFER_SIZE;
+ private volatile long sessionIdleTimeout = 0;
/**
@@ -87,6 +88,8 @@ public class WsSession implements Sessio
webSocketContainer.getDefaultMaxBinaryMessageBufferSize();
this.maxTextMessageBufferSize =
webSocketContainer.getDefaultMaxTextMessageBufferSize();
+ this.sessionIdleTimeout =
+ webSocketContainer.getMaxSessionIdleTimeout();
}
@@ -203,14 +206,13 @@ public class WsSession implements Sessio
@Override
public long getTimeout() {
- // TODO Auto-generated method stub
- return 0;
+ return sessionIdleTimeout;
}
@Override
- public void setTimeout(long seconds) {
- // TODO Auto-generated method stub
+ public void setTimeout(long timeout) {
+ this.sessionIdleTimeout = timeout;
}
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1445935&r1=1445934&r2=1445935&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Wed
Feb 13 21:23:51 2013
@@ -61,6 +61,7 @@ public class WsWebSocketContainer implem
private long defaultAsyncTimeout = -1;
private int maxBinaryMessageBufferSize = Constants.DEFAULT_BUFFER_SIZE;
private int maxTextMessageBufferSize = Constants.DEFAULT_BUFFER_SIZE;
+ private volatile long maxSessionIdleTimeout = 0;
@Override
public Session connectToServer(Class<?> annotatedEndpointClass, URI path)
@@ -378,14 +379,13 @@ public class WsWebSocketContainer implem
@Override
public long getMaxSessionIdleTimeout() {
- // TODO Auto-generated method stub
- return 0;
+ return maxSessionIdleTimeout;
}
@Override
public void setMaxSessionIdleTimeout(long timeout) {
- // TODO Auto-generated method stub
+ this.maxSessionIdleTimeout = timeout;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]