You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Leo Sutic <le...@inspireinfrastructure.com> on 2001/09/02 17:10:08 UTC

RE: [c2] Implementation advice needed!

Crossposting to Avalon-dev.

> -----Original Message-----
> From: Gerhard Froehlich [mailto:g-froehlich@gmx.de]
> Sent: den 13 september 2001 16:52
> To: cocoon-Dev
> Subject: [c2] Implementation advice needed!
>
> How can I implement with Avalon such singelton classes?

You can't.

While you can implement the ThreadSafe interface, there is nothing it its
contract that requires the component manager to make it a singleton.

Your best bet is to use the component as an adapter for a static singleton
instance, or use it to lookup the janitor service object via JNDI.

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


RE: [c2] Implementation advice needed!

Posted by Leo Sutic <le...@inspireinfrastructure.com>.

> -----Original Message-----
> From: Gerhard Froehlich [mailto:g-froehlich@gmx.de]
> Sent: den 13 september 2001 17:42
> To: cocoon-dev@xml.apache.org
> Subject: AW: [c2] Implementation advice needed!
>
>
> That's not the problem. When two Components looking up one Component, the
> looked up Component is configured twice. I'm creating a Thread in
> the configure
> method of this component. And this Thread is created twice. So
> I've to check if this
> thread already exists or something else. I don't know...

What you describe is a violation of the Avalon component lifecycle contract.
Configure is supposed to be called *once* for each instance.

Are you sure your component isn't used in two different component managers?

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


AW: [c2] Implementation advice needed!

Posted by Gerhard Froehlich <g-...@gmx.de>.
>> > How can I implement with Avalon such singelton classes?
>> 
>> You can't.
>> 
>> While you can implement the ThreadSafe interface, there is nothing it its
>> contract that requires the component manager to make it a singleton.
>
>This is taken from a private mail by Berin (hope that's ok, Berin):
>
>|The semantics used by the Avalon Excalibur Component package (which is
>|what Cocoon uses) state that only one ThreadSafe Component is created
>|and all lookups for the Component return a shared instance.
>
>So I was thinking this means
>
>  ThreadSafe = only ONE instance
That's not the problem. When two Components looking up one Component, the
looked up Component is configured twice. I'm creating a Thread in the configure
method of this component. And this Thread is created twice. So I've to check if this 
thread already exists or something else. I don't know...

Cheers
Gerhard

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [c2] Implementation advice needed!

Posted by Torsten Curdt <tc...@dff.st>.
> > How can I implement with Avalon such singelton classes?
> 
> You can't.
> 
> While you can implement the ThreadSafe interface, there is nothing it its
> contract that requires the component manager to make it a singleton.

This is taken from a private mail by Berin (hope that's ok, Berin):

|The semantics used by the Avalon Excalibur Component package (which is
|what Cocoon uses) state that only one ThreadSafe Component is created
|and all lookups for the Component return a shared instance.

So I was thinking this means

  ThreadSafe = only ONE instance

So what is it now?
regards
--
Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


AW: [c2] Implementation advice needed!

Posted by Gerhard Froehlich <g-...@gmx.de>.
Sorry, but the problem seems to be solved. I had some misleading
debug logging. It seems that the StoreJanitor is only configured
once.

Sorry again for that noise!!!!

2 beers from me!

Cheers
Gerhard
>> >Crossposting to Avalon-dev.debzg 
>> Thanx, but I'm not subscribed.
>> >You can't.
>> Why?
>> >While you can implement the ThreadSafe interface, there is nothing it its
>> >contract that requires the component manager to make it a singleton.
>> Yes I've implemented the ThreadSafe interface. But the problem is that
>> the two instance of the MRUMemoryStore configuring twice the StoreJanitor.
>> >Your best bet is to use the component as an adapter for a static
>> singleton
>> >instance, or use it to lookup the janitor service object via JNDI.
>> Ok, is there similar implementation in cocoon?
>
>No.
>
>/LS
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
>For additional commands, email: cocoon-dev-help@xml.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [c2] Implementation advice needed!

Posted by Leo Sutic <le...@inspireinfrastructure.com>.

> -----Original Message-----
> From: Gerhard Froehlich [mailto:g-froehlich@gmx.de]
> Sent: den 13 september 2001 17:24
> To: cocoon-dev@xml.apache.org
> Subject: AW: [c2] Implementation advice needed!
>
>
> >Crossposting to Avalon-dev.
> Thanx, but I'm not subscribed.
> >You can't.
> Why?
> >While you can implement the ThreadSafe interface, there is nothing it its
> >contract that requires the component manager to make it a singleton.
> Yes I've implemented the ThreadSafe interface. But the problem is that
> the two instance of the MRUMemoryStore configuring twice the StoreJanitor.
> >Your best bet is to use the component as an adapter for a static
> singleton
> >instance, or use it to lookup the janitor service object via JNDI.
> Ok, is there similar implementation in cocoon?

No.

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


AW: [c2] Implementation advice needed!

Posted by Gerhard Froehlich <g-...@gmx.de>.
>Crossposting to Avalon-dev.
Thanx, but I'm not subscribed.
>You can't.
Why?
>While you can implement the ThreadSafe interface, there is nothing it its
>contract that requires the component manager to make it a singleton.
Yes I've implemented the ThreadSafe interface. But the problem is that
the two instance of the MRUMemoryStore configuring twice the StoreJanitor.
>Your best bet is to use the component as an adapter for a static singleton
>instance, or use it to lookup the janitor service object via JNDI.
Ok, is there similar implementation in cocoon?
>/LS
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
>For additional commands, email: cocoon-dev-help@xml.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org