abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: Abdera and Singleton
Date Thu, 20 Sep 2007 14:44:11 GMT
The Abdera class is threadsafe, as are the various other top level
objects (e.g. parser, factory, etc).

- James

Fred wrote:
> ok thanks.
> 
> But, when I am using the same instance of Abdera, can I have some problem
> with concurrent access ?
> 
> I do that, because create a new instace of Abdera is very long.
> 
> Frédéric
> 
> 2007/9/19, James M Snell <jasnell@gmail.com>:
>> We could probably add this, but for a variety of classloader related
>> reasons, it's likely that it would not be a complete replacement for the
>> new Abdera() approach.
>>
>> - James
>>
>> Fred wrote:
>>> Hi,
>>>
>>> I am using Abdera, and I remark that created a new instance of Abdera
>> can be
>>> long.
>>>
>>> Can Abdera Class implement Singleton pattern ?
>>>
>>> You have to add this code in Abdera Class
>>>     private static Abdera abdera;
>>>
>>>     public static Abdera getInstance() {
>>>         if(abdera == null) {
>>>             abdera = new Abdera();
>>>         }
>>>         return abdera;
>>>     }
>>> and replace all "new Abdera()" by Abdera.getInstance().
>>>
>>> What do you think of this solution ?
>>>
>>> Regards,
>>> Frederic
>>>
> 

Mime
View raw message