Linux paging and the Java JVM

I read something interesting recently when looking at BASE databases implemented on the JVM. The linux kernel will quite aggressively swap out pages from processes when they are not being used. This can conflict with the way that generational garbage collection works in the JVM: garbage collection in particular can cause a lot of page faulting. Here the heap will be scanned for objects to be freed, however linux may have already paged out that memory making collection more expensive.


Injecting Logs into Seam Beans

When using the Seam container there is a useful @Logging annotation which injects a Log object at runtime into the bean. In the seam documentation for unit testing the advice generally is to have setters on the class to allow the dependencies to be set. For logging this is not really desirable. One alternative for this is to write a small class that will inject a Log object prior to testing:

import java.lang.reflect.Field;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.log.Log;
public class LoggerInjector {

X-Ray plugin: visualise your code in eclipse

Jacopo Malanti has recently released an excellent plugin for eclipse that allows the user to identify areas for improvement in large code-bases. It is called X-Ray. It draws two styles of diagram:


Cola: A new form of pair programming

Mustafa Isik has produced a system where two people can edit the same file in a chat like way. Conflict are resolved in real time. This, Real-Time Shared Editing, allows people to work together over the network, this could be a really good technology for when teams work from different sites on the same project. Technologies like these might allow teams to be worldwide, making the most of talent globally on the same software.

Java puzzlers and findbugs

Programmers need all the help they can get. It can be a thankless task sometimes and language designers with the best intentions cause misleading behavior to occur even in the simplest of code. The authors of Java Puzzlers, have mined the Java specifications misleading problems that cause issues in production code. It makes interesting reading, it can also points to scary traps that could trip up the hapless programmer. They do however recommend a tool called findbugs that will literally find bugs in your software.


Hamcrest and junit4.4

Since the Hamcrest matching library has been taken out of jmock and placed in its own package it looks to be generally useful for the application developer.  Hamcrest support has now gone into the new version of junit4.4, along with some other interesting features. 

The assertThat assertion now takes a matcher which provides a better alternative to assertTrue improving the error report when a test does fail.  Here are some examples:



Dependancy Structure Matrix

To manage complex interdependencies of components in software architectures a Dependancy Structure Matrix can be produced. This is a relatively recently documented technique is great for an overview of the project: it can be used to get a feel of the system design and the actual relationships beyond that of a block diagram. It might help to identify where the system might be brittle and require refactoring.


Hotext: Interesting new company

An interesting new service targetting teenagers has been launched in the UK. Hotext is a texting service that uses the internet rather than the Short Message Service. The user has to download a java application to their phone to use the service, it aims to be cheaper than texting for those who text a lot.


SA4J Structural Analysis for Java

I've been playing with SA4J a Structural Analysis Package for Java by IBM. This package helps with the analysis and maintenance of legacy systems, as well as helping to improve existing designs.

One real benefit of the package it helps unroll complex inter-dependancies between objects. Sometimes these "tangles" are not always easily noticable looking at the code. Just over time the system does not scale.

It identifies structural patterns in the system that hinder maintenance over time:

A tangle is a large group of objects whose relationships are so interconnected that a change in any one of them could affect all of the others. Long tangles are a major cause of instability in large systems.

Un-Signing Applets

Recently I've done a job where I needed to sign an applet. I got unstuck as some of the jars had inadvertantly got signed with the incorrect signature. However I quite quickly discovered that all the data containing the signatures and the certificate are in the meta-data of the jar. To remove a signature on a jar you can un-jar it, and remove the meta-data portion of the jar (the META-INF directory) and then jar it back up. So in unix it would be something like:

mkdir tmp
cd tmp
jar xvf ../foo.jar
rm -rf META-INF
jar cvf ../foo.jar *


Subscribe to java