users@glassfish.java.net

Curious about this -- any explanation?

From: <glassfish_at_javadesktop.org>
Date: Tue, 05 Oct 2010 08:35:14 PDT

Whiled developing new code, I have the practice of putting output statements at various places so I can get a sense of what is happening without going into the debugger. One of the places I put messages is in the constructors for backing beans like this:

[code]
@Model
@SessionScoped
public class SomeBacking() {

  public SomeBacking() {
     System.out.println("SomeBacking() " + this);

...
[/code]

What is interesting is I often get the message generated by the println method twice for the same object. In other words, the value of [b]this[/b] is the same.

It looks like the constructor is being executed twice on the same object -- is this possibly true as some side-effect of CDI? Or is the message in the log just getting copied?
[Message sent by forum member 'alan94539']

http://forums.java.net/jive/thread.jspa?messageID=484383