Java API features: JMX, RMI and AspectJ

Lately I came across some Java features that I was not aware of.

First of all the JMX:

JMX stands for Java eXtention Management. It provides an API where using the concept of Java beans one can expose some information of the program under execution to other programs. So running a java application that uses Java Beans we can connect to that application using the Java Console (comes with the Java – I did not know about it either). With this connection one can see what resources the application is using as well check for exposed variables and methods. One can also change values or invoke methods and constructors using the jconsole! I got really excited about that.

Secondly the RMI:

The RMI API provides the Remote interface which can be used so that java applications can communicate with each other. With this API client – server application can be created which opens the filed for way more applications. Well I feel a bit stupid mentioning this feature of the RMI as I figure that someone taught Java properly will be aware of it and use it but I didn’t have such luck and here I stand impressed.

Last but not least AspectJ:

AspectJ is not an API that can be used with Java is more like a different programming language that can be used on top of it. AspectJ uses semantics that can identify existing code and either enhance it with additional code or change it and replace the code with something different. This kind of programming is called Aspect Oriented Programming and is becoming quite popular as there are many advantages to it. First of all on should not read all the code that is written to modify and change it. For example (this is what a beginner does for an exercise but I think captures much of the concept of Aspect Oriented Programming) if there is a huge application that needs logging mechanism one does need to go through the code and add the code for the logging manually. Simply add an AspectJ application that identifies method calls and class constructors and prints the desired information. So logging is added as an aspect (thus Aspect Oriented)

AspectJ identifies existing code through pointcuts which are specific parts of the code. So for example one can write an AspectJ application that identifies that everytime an access to a database is done for the first time by a user a login information is needed. So the lofin aspect aspect is implemented etc.

All the above can be combined and refined into Adaptive Computing. This means that one can develop a system that can get information from its self (JMX), remotely (RMI) and change it self (AspectJ). The possibilities are endless and the technology is already deployed in networks to handle server failures, overloads and mobile systems where a user changes access point unpredictably.