Basic.java revision 3261
2362N/A * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 829N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 829N/A * This code is free software; you can redistribute it and/or modify it 829N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. 2362N/A * This code is distributed in the hope that it will be useful, but WITHOUT 829N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 829N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 829N/A * version 2 for more details (a copy is included in the LICENSE file that 829N/A * accompanied this code). 829N/A * You should have received a copy of the GNU General Public License version 829N/A * 2 along with this work; if not, write to the Free Software Foundation, 829N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 829N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 829N/A * or visit www.oracle.com if you need additional information or have any 829N/A * @summary Unit test for AsynchronousChannelGroup // test shutdown with no channels in groups for (
int i=
0; i<
500; i++) {
// group should terminate quickly // shutdown with channel in group for (
int i=
0; i<
500; i++) {
// create channel that is bound to group // last channel so should terminate after this channel is closed // group should terminate quickly for (
int i=
0; i<
10; i++) {
// shutdownNow is required to close all channels // test creating channels in group after group is shutdown // attempt to create another channel // attempt to create another channel by connecting. This should cause // the accept operation to fail. throw new RuntimeException(
"IOException cause should be ShutdownChannelGroupException");
// initiate another accept even though channel group is shutdown. // connect to the listener which should cause the accept to complete throw new RuntimeException(
"IOException cause should be ShutdownChannelGroupException");
// group should *not* terminate as channels are open // close channel; group should terminate quickly