29 import java.io.FileInputStream;
30 import java.io.FileOutputStream;
31 import java.io.IOException;
32 import java.io.InputStream;
33 import java.io.OutputStream;
34 import java.io.RandomAccessFile;
35 import java.lang.instrument.ClassFileTransformer;
36 import java.lang.instrument.Instrumentation;
37 import java.net.ServerSocket;
38 import java.net.Socket;
39 import java.security.ProtectionDomain;
40 import java.util.concurrent.CountDownLatch;
41
42
43 /**
44 * @test
45 * @key jfr
46 * @summary This test runs JFR with a javaagent that reads/writes files and
47 * sockets during every class definition. This is to verify that the i/o
48 * instrumentation in JFR does not interfere with javaagents.
49 *
50 * @library /test/lib /test/jdk
51 * @modules java.instrument
52 *
53 * @run shell MakeJAR.sh EvilInstrument 'Can-Redefine-Classes: true'
54 * @run main/othervm -javaagent:EvilInstrument.jar jdk.jfr.event.io.EvilInstrument
55 */
56
57 public class EvilInstrument {
58
59 CountDownLatch socketEchoReady = new CountDownLatch(1);
60 ServerSocket ss;
61
62 /**
63 * Thread that echos everything from a socket.
64 */
65 class SocketEcho extends Thread
66 {
67 public SocketEcho() {
68 setDaemon(true);
|
29 import java.io.FileInputStream;
30 import java.io.FileOutputStream;
31 import java.io.IOException;
32 import java.io.InputStream;
33 import java.io.OutputStream;
34 import java.io.RandomAccessFile;
35 import java.lang.instrument.ClassFileTransformer;
36 import java.lang.instrument.Instrumentation;
37 import java.net.ServerSocket;
38 import java.net.Socket;
39 import java.security.ProtectionDomain;
40 import java.util.concurrent.CountDownLatch;
41
42
43 /**
44 * @test
45 * @key jfr
46 * @summary This test runs JFR with a javaagent that reads/writes files and
47 * sockets during every class definition. This is to verify that the i/o
48 * instrumentation in JFR does not interfere with javaagents.
49 * @requires vm.hasJFR
50 *
51 * @library /test/lib /test/jdk
52 * @modules java.instrument
53 *
54 * @run shell MakeJAR.sh EvilInstrument 'Can-Redefine-Classes: true'
55 * @run main/othervm -javaagent:EvilInstrument.jar jdk.jfr.event.io.EvilInstrument
56 */
57
58 public class EvilInstrument {
59
60 CountDownLatch socketEchoReady = new CountDownLatch(1);
61 ServerSocket ss;
62
63 /**
64 * Thread that echos everything from a socket.
65 */
66 class SocketEcho extends Thread
67 {
68 public SocketEcho() {
69 setDaemon(true);
|