Hessian2Output Performance Cookbook

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
Ferg (Talk | contribs)
(New page: Category: Cookbook Category: Hessian Hessian's performance can be improved with a few basic use patterns. When your object graphs are acyclic (no shared objects or circular), you...)

Latest revision as of 20:15, 27 December 2011


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.

Personal tools