[prev in list] [next in list] [prev in thread] [next in thread]
List: openejb-development
Subject: Re: ASM proxy improvement
From: David Blevins <david.blevins () gmail ! com>
Date: 2013-01-02 20:49:38
Message-ID: F549414B-3BF1-40E8-933D-387502CFD31F () gmail ! com
[Download RAW message or body]
Just a note that Unsafe definitely is portable. We investigated it when Geronimo \
started using it (rather OpenEJB uses it for CMP and other things). It's the one \
exception to the "not portable" rule and is considerably faster than any alternative \
because it goes directly at memory addresses, skips security checks, etc. Hence the \
name Unsafe. A secret uber-tool and De Facto standard of the JVM.
It's been regularly tested on 8 different platforms, from Windows to zOS, and a \
handful of JVMs (Sun linux/windows, mac, IBM everything) for the last 6+ years and \
we've never seen a portability issue.
-David
On Dec 31, 2012, at 3:15 AM, Mark Struberg <struberg@yahoo.de> wrote:
> hi folks!
>
> While looking at the ASM proxy David imported to OWB I saw that it's based on the \
> sun.misc.Unsafe class. This makes this approach non-portable to other JVMs.
>
> I now played around with an alternative way to do the same: I just invoke the \
> protected ClassLoader#defineClass method via reflection instead. In my tests this \
> works pretty well already. See defineAndLoadClass in [1]. Maybe I can even remove \
> the 2nd explicit loadClass. It also works without in java6 but the docs says that \
> the class is only available after doing a loadClass. Would need some more tests to \
> make sure it also works portable without this redundant call.
> Happy about any feedback.
>
>
> LieGrue,
> strub
>
>
> [1] http://svn.apache.org/repos/asf/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/asm/InterceptorDecoratorProxyFactory.java
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic