View | Details | Raw Unified | Return to bug 56905
Collapse All | Expand All

(-)java/org/apache/tomcat/websocket/server/LocalStrings.properties (-1 / +1 lines)
Lines 22-28 Link Here
22
serverContainer.pojoDeploy=POJO class [{0}] deploying to path [{1}] in ServletContext [{2}]
22
serverContainer.pojoDeploy=POJO class [{0}] deploying to path [{1}] in ServletContext [{2}]
23
serverContainer.servletContextMismatch=Attempted to register a POJO annotated for WebSocket at path [{0}] in the ServletContext with context path [{1}] when the WebSocket ServerContainer is allocated to the ServletContext with context path [{2}]
23
serverContainer.servletContextMismatch=Attempted to register a POJO annotated for WebSocket at path [{0}] in the ServletContext with context path [{1}] when the WebSocket ServerContainer is allocated to the ServletContext with context path [{2}]
24
serverContainer.servletContextMissing=No ServletContext was specified
24
serverContainer.servletContextMissing=No ServletContext was specified
25
serverContainer.threadGroupNotDestroyed=Unable to destroy WebSocket thread group [{0}] as some threads were still running when the web application was stopped
25
serverContainer.threadGroupNotDestroyed=Unable to destroy WebSocket thread group [{0}] as {1} threads were still running when the web application was stopped
26
26
27
uriTemplate.duplicateParameter=The parameter [{0}] appears more than once in the path which is not permitted
27
uriTemplate.duplicateParameter=The parameter [{0}] appears more than once in the path which is not permitted
28
uriTemplate.emptySegment=The path [{0}] contains one or more empty segments which are is not permitted
28
uriTemplate.emptySegment=The path [{0}] contains one or more empty segments which are is not permitted
(-)java/org/apache/tomcat/websocket/server/WsServerContainer.java (-5 / +34 lines)
Lines 273-285 Link Here
273
    public void destroy() {
273
    public void destroy() {
274
        shutdownExecutor();
274
        shutdownExecutor();
275
        super.destroy();
275
        super.destroy();
276
        // If the executor hasn't fully shutdown it won't be possible to
277
        // destroy this thread group as there will still be threads running.
278
        // Mark the thread group as daemon one, so that it destroys itself
279
        // when thread count reaches zero.
280
        // Synchronization on threadGroup is needed, as there is a race between
281
        // destroy() call from termination of the last thread in thread group
282
        // marked as daemon versus the explicit destroy() call.
283
        int threadCount = threadGroup.activeCount();
284
        boolean success = false;
276
        try {
285
        try {
277
            threadGroup.destroy();
286
            while (true) {
278
        } catch (IllegalThreadStateException itse) {
287
                int oldThreadCount = threadCount;
279
            // If the executor hasn't fully shutdown it won't be possible to
288
                synchronized (threadGroup) {
280
            // destroy this thread group as there will still be threads running
289
                    if (threadCount > 0) {
290
                        Thread.yield();
291
                        threadCount = threadGroup.activeCount();
292
                    }
293
                    if (threadCount > 0 && threadCount != oldThreadCount) {
294
                        // Value not stabilized. Retry.
295
                        continue;
296
                    }
297
                    if (threadCount > 0) {
298
                        threadGroup.setDaemon(true);
299
                    } else {
300
                        threadGroup.destroy();
301
                        success = true;
302
                    }
303
                    break;
304
                }
305
            }
306
        } catch (IllegalThreadStateException exception) {
307
            // Fall-through
308
        }
309
        if (!success) {
281
            log.warn(sm.getString("serverContainer.threadGroupNotDestroyed",
310
            log.warn(sm.getString("serverContainer.threadGroupNotDestroyed",
282
                    threadGroup.getName()));
311
                    threadGroup.getName(), Integer.valueOf(threadCount)));
283
        }
312
        }
284
    }
313
    }
285
314

Return to bug 56905