|
From: Bill B. <bb...@re...> - 2008-08-22 19:05:35
|
Ok, that helps.
Now, in the constructor add this:
public MyResourceA()
{
new Exception.printStackTrace();
...the id printing...
}
This will tell us exactly who is instantiating the resource.
Paulo Siqueira wrote:
> MyResourceA should be a singleton right? Only instantiated once?
>
>
> Yes and yes.
>
>
> I just can't see this as a Resteasy problem. Can you put in a
> default constructor and see how many times an instance of
> MyResourceA is instantiated? Another thing maybe could be to use
> setter injection and log there to see how many times the setter is
> call. A final thing, create some random ID per instance and print
> it out to see if you have different instances.
>
>
> Following your suggestions, here is an output we got:
>
> 15:33:34,597 INFO [STDOUT] Instantiating LocatingResource: 1219430014597
> 15:33:34,616 INFO [STDOUT] new Seci being injected at LocatingResource:
> 1219430014597
> 15:33:34,619 INFO [ContextLoader] Root WebApplicationContext:
> initialization completed in 506 ms
>
> 15:34:12,010 INFO [STDOUT] Instantiating LocatingResource: 1219430052010
> 15:34:12,013 INFO [STDOUT] 'fabiopqp' URL begin called at
> LocatingResource: 1219430052010
> 15:34:12,013 INFO [STDOUT] Injected Seci for this call: null
>
> "LocatingResource" is the name of the Resteasy bean. Notice that it is
> instantiated twice: one in the startup (first three outputs), and
> another when a URL mapped to a method is called (last three outputs).
>
> Also, in the second time, the injector method is not called, and thus
> the correspondent field is null.
>
> []s,
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|