2016-04-22 16:24 GMT+03:00  <ma...@apache.org>:
> Author: markt
> Date: Fri Apr 22 13:24:13 2016
> New Revision: 1740523
>
> URL: http://svn.apache.org/viewvc?rev=1740523&view=rev
> Log:
> Expand checks for proper WebSocket shutdown
>
> Modified:
>     tomcat/tc7.0.x/trunk/   (props changed)
>     
> tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/BackgroundProcessManager.java
>     
> tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java
>     
> tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestClose.java
>     
> tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestCloseBug58264.java
>     
> tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServer.java
>     
> tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestWsServerContainer.java
>

> Modified: 
> tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/BackgroundProcessManager.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/BackgroundProcessManager.java?rev=1740523&r1=1740522&r2=1740523&view=diff
> ==============================================================================
> --- 
> tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/BackgroundProcessManager.java
>  (original)
> +++ 
> tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/BackgroundProcessManager.java
>  Fri Apr 22 13:24:13 2016
> @@ -108,6 +108,17 @@ public class BackgroundProcessManager {
>      }
>
>
> +    void shutdown() {
> +        synchronized (processesLock) {
> +            processes.clear();
> +            if (wsBackgroundThread != null) {
> +                wsBackgroundThread.halt();
> +                wsBackgroundThread = null;
> +            }
> +        }
> +    }
> +
> +
>      private static class WsBackgroundThread extends Thread {
>
>          private final BackgroundProcessManager manager;
>
> Modified: 
> tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java?rev=1740523&r1=1740522&r2=1740523&view=diff
> ==============================================================================
> --- 
> tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java 
> (original)
> +++ 
> tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java 
> Fri Apr 22 13:24:13 2016
> @@ -41,5 +41,8 @@ public abstract class WebSocketBaseTest
>          }
>
>          Assert.assertEquals(0, 
> BackgroundProcessManager.getInstance().getProcessCount());
> +
> +        // Ensure the next test is not affected
> +        BackgroundProcessManager.getInstance().shutdown();
>      }
>  }

The above shutdown() call won't help.  In case of a failure the Assert
throws an Assert[ion?]Error and shutdown() method won't be called.

It can be moved into a separate method annotated with @After, or into
a finally block.


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to