Hessian2Output Performance Cookbook
From Resin 3.0
Hessian's performance can be improved with a few basic use patterns.
When your object graphs are acyclic (no shared objects or circular), you can save performance with the following pattern:
private HessianFactory _hFactory = new HessianFactory(); ... OutputStream myOs = ...; Hessian2Output hOut = hFactory.createHessian2Output(myOs); hOut.setUnshared(true); hOut.writeObject(myObj); hOut.close(); hFactory.freeHessian2Output(hOut);
The setUnshared tells Hessian that none of the objects will be shared, which will save some HashMap lookups. Using the HessianFactory also saves time by saving the reflection information and also the Hessian2Output objects.