🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15638

Re: limmiting the number of instances in java

#15638
From: Omer Azhar Qureshi
Date: Tue, 18 May 1999 00:00
26 lines
1156 bytes
Tor,
thanx 4 the early relpy

> public class Singleton {
>
>   protected Singleton() { }
>
>   private Singleton _inst = null;
>
>   public static Instance() {
>     if (_inst == null)
>       _inst = new Singleton();
>     return _inst;
>   }
>
> }

ive tried this already but it dosent stop the instance of the class to be
made using the new operator.... and thats exactly what i wanna do....
what im trying 2 do is that im trying 2 implement a singleton patren in
java....
isnt there a workaround for that????

thanx in advance
regards
Oaq
Technical Details
Message-ID: <7hrh6c$bie19@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7hr7ck$bif3@forums.borland.com> <uiu9qkcis.fsf@sds.no>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,88037c7ffe1531f
X-Google-Attributes: gidf74b3,public
From: "Omer Azhar Qureshi" <oaq@systemeltd.com.pk>
Subject: Re: limmiting the number of instances in java
Date: 1999/05/18
Message-ID: <7hrh6c$bie19@forums.borland.com>
X-Deja-AN: 479385673
References: <7hr7ck$bif3@forums.borland.com> <uiu9qkcis.fsf@sds.no>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0810.800
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.language