Yep! My thoughts are that there's something wrong with your code, but since this isn't your real code, we can't see what it is. Unless you show us the actual code, there's nothing we can do to help you.
Jeanne Boyarsky wrote:Ephraim,
How are you running the method? Is it a standalone Java program that launches each time? If so, it is in a different JVM and the static fields start over.
I'm running it as a javabean ( on websphere61.) and calling the processMessage() in the class initializer. Its the same JVm but the static field seems to be getting initialized/getting reset to 0 for each instance creation!
Try printing out which class loader you're using:
If you see the class loader changed (which the second print statement will definitely be able to tell you), then that means the class is actually a different class* with its own static fields.