9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4607272
27 * @summary tests tasks can be submitted to a channel group's thread pool.
28 * @library /test/lib bootlib
29 * @build JarUtils PrivilegedThreadFactory Attack
30 * @run driver SetupJar
31 * @run main/othervm -Xbootclasspath/a:privileged.jar AsExecutor
32 */
33
34 import java.nio.channels.AsynchronousChannelGroup;
35 import java.util.concurrent.CountDownLatch;
36 import java.util.concurrent.Executor;
37 import java.util.concurrent.Executors;
38 import java.util.concurrent.ThreadFactory;
39
40 public class AsExecutor {
41
42 public static void main(String[] args) throws Exception {
43 // create channel groups
44 ThreadFactory factory = new PrivilegedThreadFactory();
45 AsynchronousChannelGroup group1 = AsynchronousChannelGroup
46 .withFixedThreadPool(5, factory);
47 AsynchronousChannelGroup group2 = AsynchronousChannelGroup
48 .withCachedThreadPool(Executors.newCachedThreadPool(factory), 0);
49 AsynchronousChannelGroup group3 = AsynchronousChannelGroup
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4607272
27 * @summary tests tasks can be submitted to a channel group's thread pool.
28 * @library /test/lib bootlib
29 * @build PrivilegedThreadFactory Attack
30 * jdk.test.lib.util.JarUtils
31 * @run driver SetupJar
32 * @run main/othervm -Xbootclasspath/a:privileged.jar AsExecutor
33 */
34
35 import java.nio.channels.AsynchronousChannelGroup;
36 import java.util.concurrent.CountDownLatch;
37 import java.util.concurrent.Executor;
38 import java.util.concurrent.Executors;
39 import java.util.concurrent.ThreadFactory;
40
41 public class AsExecutor {
42
43 public static void main(String[] args) throws Exception {
44 // create channel groups
45 ThreadFactory factory = new PrivilegedThreadFactory();
46 AsynchronousChannelGroup group1 = AsynchronousChannelGroup
47 .withFixedThreadPool(5, factory);
48 AsynchronousChannelGroup group2 = AsynchronousChannelGroup
49 .withCachedThreadPool(Executors.newCachedThreadPool(factory), 0);
50 AsynchronousChannelGroup group3 = AsynchronousChannelGroup
|