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

(-)java/org/apache/tomcat/util/net/AprEndpoint.java (-8 / +7 lines)
Lines 1017-1034 Link Here
1017
     */
1017
     */
1018
    protected Worker getWorkerThread() {
1018
    protected Worker getWorkerThread() {
1019
        // Allocate a new worker thread
1019
        // Allocate a new worker thread
1020
        Worker workerThread = createWorkerThread();
1020
        synchronized (workers) {
1021
        while (workerThread == null) {
1021
            Worker workerThread;
1022
            try {
1022
            while ((workerThread = createWorkerThread()) == null) {
1023
                synchronized (workers) {
1023
                try {
1024
                    workers.wait();
1024
                    workers.wait();
1025
                } catch (InterruptedException e) {
1026
                    // Ignore
1025
                }
1027
                }
1026
            } catch (InterruptedException e) {
1027
                // Ignore
1028
            }
1028
            }
1029
            workerThread = createWorkerThread();
1029
            return workerThread;
1030
        }
1030
        }
1031
        return workerThread;
1032
    }
1031
    }
1033
1032
1034
1033
(-)java/org/apache/tomcat/util/net/JIoEndpoint.java (-8 / +7 lines)
Lines 752-769 Link Here
752
     */
752
     */
753
    protected Worker getWorkerThread() {
753
    protected Worker getWorkerThread() {
754
        // Allocate a new worker thread
754
        // Allocate a new worker thread
755
        Worker workerThread = createWorkerThread();
755
        synchronized (workers) {
756
        while (workerThread == null) {
756
            Worker workerThread;
757
            try {
757
            while ((workerThread = createWorkerThread()) == null) {
758
                synchronized (workers) {
758
                try {
759
                    workers.wait();
759
                    workers.wait();
760
                } catch (InterruptedException e) {
761
                    // Ignore
760
                }
762
                }
761
            } catch (InterruptedException e) {
762
                // Ignore
763
            }
763
            }
764
            workerThread = createWorkerThread();
764
            return workerThread;
765
        }
765
        }
766
        return workerThread;
767
    }
766
    }
768
767
769
768
(-)java/org/apache/tomcat/util/net/NioEndpoint.java (-10 / +8 lines)
Lines 1218-1236 Link Here
1218
     */
1218
     */
1219
    protected Worker getWorkerThread() {
1219
    protected Worker getWorkerThread() {
1220
        // Allocate a new worker thread
1220
        // Allocate a new worker thread
1221
        Worker workerThread = createWorkerThread();
1221
        synchronized (workers) {
1222
        while (workerThread == null) {
1222
            Worker workerThread;
1223
            try {
1223
            while ((workerThread = createWorkerThread()) == null) {
1224
                synchronized (workers) {
1224
                try {
1225
                    workerThread = createWorkerThread();
1225
                    workers.wait();
1226
                    if ( workerThread == null ) workers.wait();
1226
                } catch (InterruptedException e) {
1227
                    // Ignore
1227
                }
1228
                }
1228
            } catch (InterruptedException e) {
1229
                // Ignore
1230
            }
1229
            }
1231
            if ( workerThread == null ) workerThread = createWorkerThread();
1230
            return workerThread;
1232
        }
1231
        }
1233
        return workerThread;
1234
    }
1232
    }
1235
1233
1236
1234

Return to bug 48843