This page will describe some considerations when porting the AnvilJ Object Manager to a new architecture.

The IPort interface

After the refactoring engine has completed its work, each output program will create an instance of anvilj.ObjectManager. This is the default implementation of the Object Manager that is used on targets that support full Java. The instantiation will look something like this:
anvilj.Settings _anviljsettings = new anvilj.Settings(true, false, false); = new anvilj.ObjectManager(
    new anvilj.socketcomms.SocketComms(0, anvilj.refactored.HostnameMapFactory.getMap()),
    new anvilj.refactored.Architecture(),
    new anvilj.refactored.ThreadCreator(),
    new anvilj.refactored.SharedMessages(),
    new anvilj.refactored.Routing(),
    new anvilj.sharedmessagehandlers.FullSerialization(null),
    new anvilj.Port());
anvilj.refactored.Globals.omThread =
    new Thread(;
Note that an instance of anvilj.Port is passed to the Object Manager. This class is the default implementation of the anvilj.interfaces.IPort interface which contains methods that may are part of the Java language but may not be directly supported on some minimal embedded systems. An example method in this interface is:
  • public long getCurrentThreadID();
On JVMs which use a different threading model may need a different way of obtaining the ID of the current thread, and this is implemented by overriding this method. Also, this interface defines a number of methods that create instances of the various Message classes. These methods are provided so that JVMs can be defined that do not support certain message types (and therefore require a smaller footprint of class files at runtime). For example, in a JVM that will not support dynamic threading, the following two methods could be replaced with null implementations:
  • public Message createThreadStart(int sourceOMID, int targetOMID, int targetThreadID);
  • public Message createThreadJoin(int sourceOMID, int targetOMID, int targetThreadID, long sourceThreadID);
This will remove the JVM's references to the anvilj.messages.ThreadStart and anvilj.messages.ThreadJoin classes and so reduce its footprint.