Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #382 - clarify session idle timeout #383

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020 Oracle and/or its affiliates and others.
* Copyright (c) 2018, 2021 Oracle and/or its affiliates and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -132,7 +132,7 @@ interface Async extends RemoteEndpoint {

/**
* Return the number of milliseconds the implementation will timeout attempting to send a websocket message. A
* non-positive number indicates the implementation will not timeout attempting to send a websocket message
* zero or negative value indicates the implementation will not timeout attempting to send a websocket message
* asynchronously. This value overrides the default value assigned in the WebSocketContainer.
*
* @return the timeout time in milliseconds.
Expand All @@ -141,7 +141,7 @@ interface Async extends RemoteEndpoint {

/**
* Sets the number of milliseconds the implementation will timeout attempting to send a websocket message. A
* non-positive number indicates the implementation will not timeout attempting to send a websocket message
* zero or negative value indicates the implementation will not timeout attempting to send a websocket message
* asynchronously. This value overrides the default value assigned in the WebSocketContainer.
*
* @param timeoutmillis The number of milliseconds this RemoteEndpoint will wait before timing out an incomplete
Expand Down
11 changes: 6 additions & 5 deletions api/client/src/main/java/jakarta/websocket/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,18 @@ public interface Session extends Closeable {
boolean isOpen();

/**
* Return the number of milliseconds before this conversation may be closed by the container if it is inactive, i.e.
* no messages are either sent or received in that time.
* Return the number of milliseconds before this session will be closed by the container if it is inactive, i.e. no
* messages are either sent or received in that time. A value that is zero or negative indicates that this timeout
* will not be used.
*
* @return the timeout in milliseconds.
*/
long getMaxIdleTimeout();

/**
* Set the non-zero number of milliseconds before this session will be closed by the container if it is inactive, ie
* no messages are either sent or received. A value that is 0 or negative indicates the session will never timeout
* due to inactivity.
* Set the number of milliseconds before this session will be closed by the container if it is inactive, i.e. no
* messages are either sent or received in that time. A value that is zero or negative indicates that this timeout
* will not be used.
*
* @param milliseconds the number of milliseconds.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019 Oracle and/or its affiliates and others.
* Copyright (c) 2018, 2021 Oracle and/or its affiliates and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -38,7 +38,7 @@ public interface WebSocketContainer {

/**
* Return the number of milliseconds the implementation will timeout attempting to send a websocket message for all
* RemoteEndpoints associated with this container. A non-positive number indicates the implementation will not
* RemoteEndpoints associated with this container. A zero or negative value indicates the implementation will not
* timeout attempting to send a websocket message asynchronously. Note this default may be overridden in each
* RemoteEndpoint.
*
Expand All @@ -48,11 +48,11 @@ public interface WebSocketContainer {

/**
* Sets the number of milliseconds the implementation will timeout attempting to send a websocket message for all
* RemoteEndpoints associated with this container. A non-positive number indicates the implementation will not
* RemoteEndpoints associated with this container. A zero or negative value indicates the implementation will not
* timeout attempting to send a websocket message asynchronously. Note this default may be overridden in each
* RemoteEndpoint.
*
* @param timeoutmillis the timeout in milliseconds or a non-positive number for no timeout
* @param timeoutmillis the timeout in milliseconds; use zero or negative value for no timeout
*/
void setAsyncSendTimeout(long timeoutmillis);

Expand Down Expand Up @@ -130,7 +130,7 @@ Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointC

/**
* Return the default time in milliseconds after which any web socket sessions in this container will be closed if
* it has been inactive. A value that is 0 or negative indicates the sessions will never timeout due to inactivity.
* it has been inactive. A value that is zero or negative indicates the sessions will never timeout due to inactivity.
* The value may be overridden on a per session basis using {@link Session#setMaxIdleTimeout(long) }
*
* @return the default number of milliseconds after which an idle session in this container will be closed
Expand All @@ -139,10 +139,10 @@ Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointC

/**
* Sets the default time in milliseconds after which any web socket sessions in this container will be closed if it
* has been inactive. A value that is 0 or negative indicates the sessions will never timeout due to inactivity. The
* has been inactive. A value that is zero or negative indicates the sessions will never timeout due to inactivity. The
* value may be overridden on a per session basis using {@link Session#setMaxIdleTimeout(long) }
*
* @param timeout the maximum time in milliseconds.
* @param timeout the maximum time in milliseconds; use zero or negative value for no timeout
*/
void setDefaultMaxSessionIdleTimeout(long timeout);

Expand Down