1 /*
2 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012 SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation. Oracle designates this
9 * particular file as subject to the "Classpath" exception as provided
10 * by Oracle in the LICENSE file that accompanied this code.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
415 myGroupAndInvokeCount.resetInvokeCount();
416
417 try {
418 replaceMe = false;
419 ev = queue.take();
420
421 // no events and this thread has been "selected" to
422 // poll for more.
423 if (ev == NEED_TO_POLL) {
424 try {
425 ev = poll();
426 } catch (IOException x) {
427 x.printStackTrace();
428 return;
429 }
430 }
431 } catch (InterruptedException x) {
432 continue;
433 }
434
435 // contine after we processed a control event
436 if (ev == CONTINUE_AFTER_CTL_EVENT) {
437 continue;
438 }
439
440 // handle wakeup to execute task or shutdown
441 if (ev == EXECUTE_TASK_OR_SHUTDOWN) {
442 Runnable task = pollTask();
443 if (task == null) {
444 // shutdown request
445 return;
446 }
447 // run task (may throw error/exception)
448 replaceMe = true;
449 task.run();
450 continue;
451 }
452
453 // process event
454 try {
455 ev.channel().onEvent(ev.events(), isPooledThread);
|
1 /*
2 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012 SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation. Oracle designates this
9 * particular file as subject to the "Classpath" exception as provided
10 * by Oracle in the LICENSE file that accompanied this code.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
415 myGroupAndInvokeCount.resetInvokeCount();
416
417 try {
418 replaceMe = false;
419 ev = queue.take();
420
421 // no events and this thread has been "selected" to
422 // poll for more.
423 if (ev == NEED_TO_POLL) {
424 try {
425 ev = poll();
426 } catch (IOException x) {
427 x.printStackTrace();
428 return;
429 }
430 }
431 } catch (InterruptedException x) {
432 continue;
433 }
434
435 // continue after we processed a control event
436 if (ev == CONTINUE_AFTER_CTL_EVENT) {
437 continue;
438 }
439
440 // handle wakeup to execute task or shutdown
441 if (ev == EXECUTE_TASK_OR_SHUTDOWN) {
442 Runnable task = pollTask();
443 if (task == null) {
444 // shutdown request
445 return;
446 }
447 // run task (may throw error/exception)
448 replaceMe = true;
449 task.run();
450 continue;
451 }
452
453 // process event
454 try {
455 ev.channel().onEvent(ev.events(), isPooledThread);
|