Skip to main content

Posts

Showing posts from April, 2016

LinkageErrors and Actors

It is not uncommon to have ClassNotFound exceptions thrown when developing applications inside OSGi world. LinkageErrors can be even seen as "normal" exceptions which can have minor effects on how the application works. Akka actors other hand really don't like linkage errors, more specifically, during message handling. If a linkage error is thrown, it will result to the whole actor system going down. Supervision strategies don't help here either, the linkage errors pass right through. To combat the problem, there are some options. The most obvious one is to wrap the actors receive method with try-catch clauses. You either do this is in every actor or create a superclass which delegates the receive to a safe method. Another option is to use compile-time weaved aspects. The actor library can be wrapped and the compiled classes can be then weaved. If using OSGi then the manifest entries need to be set correctly so that the actor classes are exported and for the ser...