author | chegar |
Tue, 09 Aug 2011 16:39:04 +0100 | |
changeset 10150 | dee4cb73adc3 |
parent 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
278
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
278
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
4 |
* |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
8 |
* |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
13 |
* accompanied this code). |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
14 |
* |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
18 |
* |
5506 | 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. |
|
278
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
22 |
*/ |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
23 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
24 |
public class RedefineClassWithNativeMethodApp { |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
25 |
public static void main(String[] args) throws Exception { |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
26 |
try { |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
27 |
// give the agent a chance to redefine the target class |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
28 |
Thread.sleep(2000); |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
29 |
} catch (InterruptedException ie) { |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
30 |
} |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
31 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
32 |
System.out.println("Creating instance of " + |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
33 |
RedefineClassWithNativeMethodAgent.clz); |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
34 |
RedefineClassWithNativeMethodAgent.clz.newInstance(); |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
35 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
36 |
System.exit(0); |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
37 |
} |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
38 |
} |