EJB design: static block initializer
We know that a code in static block initializer is executed only one when a class is loaded. However, we disagree when a class is loaded:
1) when Jboss start (we use Jboss) or
2) when the class is first referenced in the application. or
3) None of the above.
is 2 the right answer ?
2 is closer to correct, but I am not sure if it varies by application server. I believe that a class can be initialized onreference as you indicate, but since it is a static initialization block, it could be initialized when it is first loaded by the class loader which would most likely be the first time it is imported.
frankly, mu don't have a clue, nut did you try to place output a log entry from your class" static constructor? this may give you a hint. if you see your log entry during jboss' start-up, this may hint that the class is preloaded. if you see your log entry when you first call your beans, it would it's loaded only then.
to get more info you may also print a stack trace:
Exception ex = new Exception();
let us know :-)
Emil ( http://thekirschners.com/software/testare/testare.html )
oooops, I don't know what messed up my post like this..... Hope you get the idea :-) hmmmm, I wasn"t drunk though.....