[Design the new POJO MicroContainer] - Re: Multiple ClassFileTransformers/Translators
by alesj
"adrian(a)jboss.org" wrote : "alesj" wrote : WRT: https://jira.jboss.org/jira/browse/JBSPRING-1
| |
|
| "It does not work" is not a bug report. What's wrong with it?
|
| If you want to send me private e-mails asking me to look at stuff,
| at least give me something to look at. :-)
|
| Either way, I'll usually just ignore this kind of "twaddle" until the author puts some work into the question to make it answerable.
|
My WRT wasn't really meant for you to go and do detailed analysis. :-)
I thought the "my actual question is really" made this clear.
The private email was about the CL 2.0.4.GA release,
which Jason did, but didn't update the JIRA.
Since you control that space, I thought I asked there (in private email)
as I don't really see that as a dev question. ;-)
The p.s. was just semi-informal. :-)
"adrian(a)jboss.org" wrote :
| You should use an agent.
|
| The Transformer is only there for backwards compatibility with AOP from before the agent api was available.
|
| Something that is almost certainly no longer relevant except for some old tests in the testsuite.
|
| The only difference between the Transformer and the ClassFileTransformer
| is that one is inside ClassLoader.defineClass() - i.e. all classloaders
| while the other is only invoked from our ClassLoader.
|
Agent is what we currently use with that Spring's LWT.
But like Jason says, we control the classloading,
and Spring lets you set per app per environment LWT.
They have this for all other app servers, hence I created ours,
which I hope will eventually 'live' in their code.
"adrian(a)jboss.org" wrote :
| If you want to add classloader specific ClassFileTransformers to the
| BaseClassLoaderPolicy api that's ok with me.
|
Already done.
But I'm still using our Translator + adding ClassFileTransformer2Translator bridge.
"adrian(a)jboss.org" wrote :
| I think a better integration point would be to have a Spring aop deployer like
| our aop deployer to analyse (and in your case modify) the classloader
| based on metadata?
Could be done, but I don't see what this brings over their per app server approach.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222671#4222671
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222671
15 years, 8 months
[Design of Management Features on JBoss] - JBAS-6676, Suport for exposing JMX bean as ManagedObject
by scott.stark@jboss.org
This has turned out more difficult than I expected because of how the ManagedObjectFactory/Builder are oriented towards creating a ManagedObject template from a Class view that is expected to have the management annotations on it.
The problem for the JBAS-6676 issue is that there is a bean factory creating BeanMetaDatas for bean proxies whose ManagedObject interface is to mirror the JMX mbean the proxy is to promote to a ManagedObject.
One way would be to add an annotation on the metadata instance via the mdr MetaData view that is passed into the ManagedObjectFactory.
Another would be to have the metadata instance implement an ObjectInstanceFactory interface or some such that assumed the ManagedObjectFactory task of creating the ManagedObject based on the instance metadata.
Either of these could be done in time for the CR1 release. Neither one seems ideal, I'm trying each to see which is most natural for the user wanting to describe a ManagedObject.
More generally I'm thinking the way in which we create MangedObjects for a deployment should change to have the DeployersImpl generate the ManagedObjects in two passes, the first that creates a ManagedObjectMetaData view attachment if one does not exist, and then creates the ManagedObjects from this. This would allow more flexibility in how the ManagedObject view is created.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222668#4222668
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222668
15 years, 8 months
[Design of JBoss Build System] - Re: JBossRetro cannot replace final reference to StringBuild
by adrian@jboss.org
This looks to be a problem in javassist rather jboss-retro
The following test class
| public class Test
| {
| public static void main(String[] args) throws Exception
| {
| final StringBuilder s = new StringBuilder("hello");
| System.out.println(s.toString());
| }
| }
|
When run through the following simple javassist program to change the class names
| import java.io.DataInputStream;
| import java.io.DataOutputStream;
| import java.io.FileInputStream;
| import java.io.FileOutputStream;
| import javassist.bytecode.ClassFile;
|
| public class Rename
| {
| public static void main(String[] args) throws Exception
| {
| DataInputStream dis = new DataInputStream(new FileInputStream("Test.class"));
| ClassFile cf = new ClassFile(dis);
| cf.renameClass("Test", "Test1");
| cf.renameClass("java/lang/StringBuilder", "test/StringBuilder");
| DataOutputStream dos = new DataOutputStream(new FileOutputStream("Test1.class"));
| cf.write(dos);
| }
| }
|
Isn't renaming the literal used by the local variable table
I think because it is marked as type "Asciz" rather than "class"?
BEFORE
| $ javap -c -verbose Test
| Compiled from "Test.java"
| public class Test extends java.lang.Object
| SourceFile: "Test.java"
| minor version: 0
| major version: 49
| Constant pool:
| const #1 = Method #9.#20; // java/lang/Object."<init>":()V
| const #2 = class #21; // java/lang/StringBuilder
| const #3 = String #22; // hello
| const #4 = Method #2.#23; // java/lang/StringBuilder."<init>":(Ljava/lang/String;)V
| const #5 = Field #24.#25; // java/lang/System.out:Ljava/io/PrintStream;
| const #6 = Method #2.#26; // java/lang/StringBuilder.toString:()Ljava/lang/String;
| const #7 = Method #27.#28; // java/io/PrintStream.println:(Ljava/lang/String;)V
| const #8 = class #29; // Test
| const #9 = class #30; // java/lang/Object
| const #10 = Asciz <init>;
| const #11 = Asciz ()V;
| const #12 = Asciz Code;
| const #13 = Asciz LineNumberTable;
| const #14 = Asciz main;
| const #15 = Asciz ([Ljava/lang/String;)V;
| const #16 = Asciz Exceptions;
| const #17 = class #31; // java/lang/Exception
| const #18 = Asciz SourceFile;
| const #19 = Asciz Test.java;
| const #20 = NameAndType #10:#11;// "<init>":()V
| const #21 = Asciz java/lang/StringBuilder;
| const #22 = Asciz hello;
| const #23 = NameAndType #10:#32;// "<init>":(Ljava/lang/String;)V
| const #24 = class #33; // java/lang/System
| const #25 = NameAndType #34:#35;// out:Ljava/io/PrintStream;
| const #26 = NameAndType #36:#37;// toString:()Ljava/lang/String;
| const #27 = class #38; // java/io/PrintStream
| const #28 = NameAndType #39:#32;// println:(Ljava/lang/String;)V
| const #29 = Asciz Test;
| const #30 = Asciz java/lang/Object;
| const #31 = Asciz java/lang/Exception;
| const #32 = Asciz (Ljava/lang/String;)V;
| const #33 = Asciz java/lang/System;
| const #34 = Asciz out;
| const #35 = Asciz Ljava/io/PrintStream;;
| const #36 = Asciz toString;
| const #37 = Asciz ()Ljava/lang/String;;
| const #38 = Asciz java/io/PrintStream;
| const #39 = Asciz println;
|
| {
| public Test();
| Code:
| Stack=1, Locals=1, Args_size=1
| 0: aload_0
| 1: invokespecial #1; //Method java/lang/Object."<init>":()V
| 4: return
| LineNumberTable:
| line 1: 0
|
| public static void main(java.lang.String[]) throws java.lang.Exception;
| Code:
| Stack=3, Locals=2, Args_size=1
| 0: new #2; //class java/lang/StringBuilder
| 3: dup
| 4: ldc #3; //String hello
| 6: invokespecial #4; //Method java/lang/StringBuilder."<init>":(Ljava/lang/String;)V
| 9: astore_1
| 10: getstatic #5; //Field java/lang/System.out:Ljava/io/PrintStream;
| 13: aload_1
| 14: invokevirtual #6; //Method java/lang/StringBuilder.toString:()Ljava/lang/String;
| 17: invokevirtual #7; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
| 20: return
| LineNumberTable:
| line 5: 0
| line 6: 10
| line 7: 20
| Exceptions:
| throws java.lang.Exception
| }
|
AFTER
| [ejort@warjort final-test]$ javap -c -verbose Test1
| Compiled from "Test.java"
| public class Test1 extends java.lang.Object
| SourceFile: "Test.java"
| minor version: 0
| major version: 49
| Constant pool:
| const #1 = Method #9.#20; // java/lang/Object."<init>":()V
| const #2 = class #41; // test/StringBuilder
| const #3 = String #22; // hello
| const #4 = Method #2.#23; // test/StringBuilder."<init>":(Ljava/lang/String;)V
| const #5 = Field #24.#25; // java/lang/System.out:Ljava/io/PrintStream;
| const #6 = Method #2.#26; // test/StringBuilder.toString:()Ljava/lang/String;
| const #7 = Method #27.#28; // java/io/PrintStream.println:(Ljava/lang/String;)V
| const #8 = class #40; // Test1
| const #9 = class #30; // java/lang/Object
| const #10 = Asciz <init>;
| const #11 = Asciz ()V;
| const #12 = Asciz Code;
| const #13 = Asciz LineNumberTable;
| const #14 = Asciz main;
| const #15 = Asciz ([Ljava/lang/String;)V;
| const #16 = Asciz Exceptions;
| const #17 = class #31; // java/lang/Exception
| const #18 = Asciz SourceFile;
| const #19 = Asciz Test.java;
| const #20 = NameAndType #10:#11;// "<init>":()V
| const #21 = Asciz java/lang/StringBuilder;
| const #22 = Asciz hello;
| const #23 = NameAndType #10:#32;// "<init>":(Ljava/lang/String;)V
| const #24 = class #33; // java/lang/System
| const #25 = NameAndType #34:#35;// out:Ljava/io/PrintStream;
| const #26 = NameAndType #36:#37;// toString:()Ljava/lang/String;
| const #27 = class #38; // java/io/PrintStream
| const #28 = NameAndType #39:#32;// println:(Ljava/lang/String;)V
| const #29 = Asciz Test;
| const #30 = Asciz java/lang/Object;
| const #31 = Asciz java/lang/Exception;
| const #32 = Asciz (Ljava/lang/String;)V;
| const #33 = Asciz java/lang/System;
| const #34 = Asciz out;
| const #35 = Asciz Ljava/io/PrintStream;;
| const #36 = Asciz toString;
| const #37 = Asciz ()Ljava/lang/String;;
| const #38 = Asciz java/io/PrintStream;
| const #39 = Asciz println;
| const #40 = Asciz Test1;
| const #41 = Asciz test/StringBuilder;
|
| {
| public Test1();
| Code:
| Stack=1, Locals=1, Args_size=1
| 0: aload_0
| 1: invokespecial #1; //Method java/lang/Object."<init>":()V
| 4: return
| LineNumberTable:
| line 1: 0
|
| public static void main(java.lang.String[]) throws java.lang.Exception;
| Code:
| Stack=3, Locals=2, Args_size=1
| 0: new #2; //class test/StringBuilder
| 3: dup
| 4: ldc #3; //String hello
| 6: invokespecial #4; //Method test/StringBuilder."<init>":(Ljava/lang/String;)V
| 9: astore_1
| 10: getstatic #5; //Field java/lang/System.out:Ljava/io/PrintStream;
| 13: aload_1
| 14: invokevirtual #6; //Method test/StringBuilder.toString:()Ljava/lang/String;
| 17: invokevirtual #7; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
| 20: return
| LineNumberTable:
| line 5: 0
| line 6: 10
| line 7: 20
| Exceptions:
| throws java.lang.Exception
| }
|
See the in both:
const #21 = Asciz java/lang/StringBuilder;
So this needs to be raised as a bug in javassist rather than jboss-retro
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222661#4222661
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222661
15 years, 8 months