abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred <frederic.augu...@gmail.com>
Subject Abdera and Singleton
Date Wed, 19 Sep 2007 09:08:36 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message