|
[aop]
AWProxy: Proxy on steroids
[
jonas
]
SummaryProxies are an important piece in the J2EE puzzle. Since it offers a non-intrusive an more transparent way of weaving in advice/interceptors. However, non of the current proxy implementations utilizes all the rich semantics of AOP (as defined by AspectJ), the expressiveness of a real pointcut pattern language and has the speed of statically compiled code. AW Proxy is here to try to narrow this gap. It makes use of the rich semantics for AOP in AspectWerkz and is very high-performant due to the use of static compilation (utilizing the AspectWerkz weaver). All wrapped up a very simple and intuitive API. The need for proxiesThe two arguments against load-time weaving that we hear the most are:
Adding the possibility of using AspectWerkz together with proxies is something that Alex and I have been talking about for a long time but never implemented due to lack of time. Well, this weekend I took the time and it was actually more simple than I thought. After a couple of hours coding (taking the cglib route with its "class proxy", e.g creating a new class on-the-fly that extends the target class and which methods and constructors delegates to the base class' methods, but with the difference that they don't wrap the arguments but pass them on as they are, which gives a lot better performance), I had a working solution. Introducing AW ProxyThe benefit with using the AspectWerkz Proxies compared to the regular load time weaving is that there are no VM options. You simply create your proxy and before it is returned to you it is weaved with the aspects that happens to be available on the classpath at that time. The API is pretty straight forward. All you need is in the
org.codehaus.aspectwerkz.proxy.Proxy
class which has the following API:
// Returns a new proxy for the class specified
public static Object newInstance(Class clazz);
// Returns a new proxy for the class specified, instantiates it by invoking the constructor
// with the argument list specified
public static Object newInstance(Class clazz, Class[] argumentTypes, Object[] argumentValues);
// Same as above, but with optional parameters for caching and making the proxy advisable
public static Object newInstance(Class clazz, boolean useCache, boolean makeAdvisable);
// Same as above, but with optional parameters for caching and making the proxy advisable
public static Object newInstance(Class clazz, Class[] argumentTypes, Object[] argumentValues,
boolean useCache, boolean makeAdvisable);
How to use the API?
Here is a little example on how to use the
// creates and instantiates a new proxy for the class Target
Target target = (Target) Proxy.newInstance(Target.class, false);
That's it!
This Utilizing programmatic runtime deploymentAs I said before, when you create your proxy it will get automatically weaved with all the matching aspects that are found (on the classpath). This is most of the time what you want and need, but there might be cases when you want to add a specific feature, at runtime, to a specfific instance only. In these cases you need programmatic runtime per instance deployment. One of the new features in the AspectWerkz 2 architecture is that it comes with a full-blown interception framework that allows per instance programmatic deployment with most of the AOP semantics preserved.
In short you will get:
POJO pojo = new POJO();
// adds tracing to all methods in the 'pojo' instance
((Advisable) pojo).aw$addAdvice(
"* *.*(..)",
new BeforeAdvice() {
public Object invoke(JoinPoint jp) {
System.out.println("Entering: " + jp.getSignature().toString());
}
}
);
The advice "interceptors" that are supported are:
Now we can combine use this feature together with the AW Proxies. All proxies that are created implements the Example
In this example we create and instantiate a new proxy for the class
Advisable target = (Advisable) Proxy.newInstance(Target.class, true, true);
target.aw$addAdvice(
"String *.*(..)",
new AfterReturningAdvice() {
public void invoke(JoinPoint jp, Object returnValue) {
// do some stuff
}
}
);
BenefitsPlain proxies with rich AOP semantics
The benefits are, besides a less intrusive and more transparent approach, that you can utilize the rich semantics for AOP (well, not all, see below for limitations) that are supported AspectWerkz. Such as, a rich pointcut expression language, before/after/around advice, deployment modules defined by the Very high-performantYou will also get the full performance of the AspectWerkz 2 architecture. If you are interested details of the benchmark we made (and/or run it yourself) then you can read this paper. But in short AW Proxy is roughly:
Limitations
Since it is a proxy approach it only supports Resources
This new feature will be available in AspectWerkz 2.0 RC2 that will be available soon. Until then you can check out the sources from the CVS and build it yourself (by invoking
There are some samples in the Enjoy. TrackBack*Very* nice! --Brian McCallister, December 8, 2004 02:54 PM
Hi There, Congrats. Is there a printable page link ? Thanks, BR, --anjan bacchu, December 8, 2004 10:21 PM
this site blows and sterioods are bad for your health!!! --Michael Romyns, February 18, 2005 05:08 PM
The restriction of 1 Proxy/class seems rather limiting. --asi, February 22, 2005 06:42 PM
hi --Athar, August 6, 2005 07:41 PM
Great site! http://clearpharma.com/ Clearpharma.com: best offers on anabolics and steroids and other bodybuilding products and information. Low prices and excellent service - it is our price/quality strategy, you'll like it ! --ruby, November 13, 2005 11:10 PM
Clearpharma is a scam. STAY AWAY --FRANK, August 1, 2006 10:31 PM
you'r crazy, clearpharma.com is great, low prices, real delivery, i used them and i'm happy --John, August 12, 2006 08:50 AM
www.clearpharma.com is a scam. They stay in contact with you but that is part of the illusion that they are a legit company. You will never get your order. A few weeks after you send the money they will say that you gave them the wrong shipping address and your order was sent back to them. That will be the last time you will communicate with anyone from clearpharma.com --greg, August 16, 2006 12:24 AM
I've received my order from clearpharma.com in 8 days after payment, this guys is real steroid supplier, I haven't any problems with this company! --henry, August 17, 2006 10:30 AM
Clearpharma is a scam I have been scammed by many, iam trying this place we will see how it goes, my friends told me it was legit but we will see. roids are a gift, only the missinformed are idiots www.getgear.8k.com --Pete Warren, August 25, 2006 01:34 AM
clearpharma.com is real guys, i sent $508 and received my package, and you are stupid idiot, your link doesn't work....try it getgear.8k --daryl, September 21, 2006 04:32 PM
Hello,I'm a supplier of steroid powders from China. Here is my list for the products. High Quality, good price, quick and safe delivery. If you want to get any orders, contact at: freewings@hushmail.com If source is not allowed here,I apologize and please delete. Thank you. Anastrozole, USP28 High Quality, good price, quick and safe delivery. If you want to get any orders, contact at: freewings@hushmail.com
--F.W Pharmcy, October 16, 2006 06:08 AM
High quality,good price,quick and safe delivery. If you want any orders,contact at: freewings@hushmail.com Anastrozole, USP28 High quality,good price,quick and safe delivery. If you want any orders,contact at: freewings@hushmail.com --freewings, November 10, 2006 02:55 AM
WWW.STEROIDSUPPLYER.COM If you are still looking for trusted source there you can buy steroids please visit our website. SHOP@STEROIDSUPPLYER.COM
Testenon 135mg/ml amp. 1ml = 2 EURO ====================================== Anabol 5mg N1000 = 140 EURO ====================================== Jintropin printed vial 4IU N10 = 20 EURO ===================================== Deca-Durabolin 100mg/ml 2ml (Greece) = 14 EURO ====================================== Winstrol 50mg/ml = 8 EURO ====================================== Anapolon 50mg N20 = 45 EURO WWW.STEROIDSUPPLYER.COM --WWW.STEROIDSUPPLYER.COM, July 3, 2007 11:43 AM
SENT ORDER TO CLEARPHARMA 1-28-08-THAY SAY NOT RIGHT ADD.THAY DO NOT SEND.THERE SO BAD THAY TOKE AWAY A WAY TO REACH THAM.THAY TELL SAME STORYS TO A LOT OF OTHERS.DO NOT ORDER. --ROBERT HERMANDES, March 29, 2008 04:28 PM
CLEARPHARMA IS NOT A PHARMASEE. I HAVE A PRESCRIPTION.(NOT ORDERING STEROIDS).BUT OTHER MEDICATIONS.THEY SAY NOT RIGHT ADDRESS. THEN STILL DONT SEND ORDER.I ASKED POST OFFICE IF ANY ORDERS COME WITH NOT RIGHT ADDRESS FORM CLEARPHARMA.THAT WAS SENT BACK. POST OFFICE LOOKED SAID NO. THIS TILLES YOU SOMTHING. ABOUT THEM --ROBERT HERMANDES, April 21, 2008 03:53 PM
clearpharma is no longer on internet.they only can play games so long befor sit is not making any money. --robert hermandes, May 9, 2008 03:49 PM
For bulk orders or inquiries on Jintropin or Jintropin AQ --Wendy Lau, May 20, 2008 02:09 PM
Isn't the website of GeneScience www.gensci-china.com (without "e" in gensci)? Interesting questions, are they? --Fung Ku, June 4, 2008 08:28 PM
hi there i lost my old hush account and everyone in it could you please e.mail me your price list thank you yours sincerly Darren. --darren, July 13, 2008 11:16 PM
Isn't the website of GeneScience www.gensci-china.com (without "e" in gensci)? Yes!! If I call +86 431 85193278, will be there a Wendy Lau? Yes, before you pay, please call the real number of GenSci which were put on the fake website by Wendy Lau, then the employee from GenSci will tell you the truth! Wenday Lau has nothing to do with GenSci, it is scam. Be careful!!! Why the owners of gensci-china.com and genesci-china.com are different? gensci-china.com is real; --yaya, August 6, 2008 05:10 AM
I made a spelling mistake! If you phone 85193278, you can find there is no wendy lau. so do not waste your money on fake products!!!! --yaya, August 6, 2008 05:13 AM
Yaya your David Garcia gensci-china.com is a scammer --Mike, August 22, 2008 02:40 PM
Hey Mike can you email me I lost 2000 bucks to gensci-china aka Mr.Garca...lets see if we got the same WU info --Gman, August 30, 2008 08:21 PM
David Garcia has nothing to do with GenSci!! --yaya, September 3, 2008 09:57 AM
Post a comment
|