Advanced AspectJ part III : non-kinded pointcuts

Today we will focus on non-kinded poincuts of AspectJ.

Unlike kinded pointcuts (method execution, field access, object initialization …), non-kinded pointcuts select join point on some criteria other than the join point signature (no kind). For example it is possible to select join points inside the source code(lexical structure) of a Java class or method.

Read more of this post


Advanced AspectJ Part II : Inter-type declaration

In this article, we discuss about another ApectJ advanced feature: inter-type declaration (ITD), or more commonly called member introduction.

In essence, this feature lets you “inject” new fields or methods into an existing class using an aspect.

With ITD you can for example achieve virtual multiple inheritance or mixin. It is extremely powerfull but also very bug-prone because it somehow breaks basic Java encapsulation rules.

Read more of this post

Advanced AspectJ Part I : Instanciation model

In this serie of articles we’ll talk about advanced features in AspectJ. This will exclude for sure popular AspectJ construct like method execution or within join points.

This first article deals with the instanciation model of AspectJ

As support for our talk, we’ll create a logger injection using annotation and AspectJ.

Read more of this post

ThreadLocal explained

Today we are going to look into the ThreadLocal internals, its usage and all the related pitfalls.

ThreadLocal, among other Java advanced features like volatile variables or nested classes, is rarely used.

The main reason is its relative complexity and mostly the very few cases where ThreadLocal is really required.

Yet, if its underlying mechanism is well understood, ThreadLocal can be very handy in some situations. No wonder it is at the heart of some framework features, Spring
TransactionSynchronizationManager for example.
Read more of this post