Re: [PHP] Singleton pattern question

From: Raditha Dissanayake (jabber_at_raditha.com)
Date: 01/01/04


Date: Thu, 01 Jan 2004 06:55:39 +0600
To: Hardik Doshi <php_hardik@yahoo.com>,  php-general@lists.php.net

Hi,.
Unfortunately in PHP this may be true, however in j2ee if you use the
singleton pattern the result would be what you expect.

happy new year.

Hardik Doshi wrote:

>Hi Group,
>
>Currently i am using the singleton design pattern in
>one of my projects. I was under impression that by
>using the singleton pattern i need to initialize
>system configuration only one time (At the time of
>login) but once i implemented the system, i came to
>know that system initializes an instance on every
>request of the webpage (On every request, singleton
>class reads the system configuration and returns the
>new instance).
>
>Is that the normal nature of using the singleton
>pattern in the web environment?
>
>Please let me know.
>
>Thanks
>Hardik
>
>__________________________________
>Do you Yahoo!?
>Find out what made the Top Yahoo! Searches of 2003
>http://search.yahoo.com/top2003
>
>
>

-- 
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.


Relevant Pages

  • Re: Singleton
    ... Responding to Mingins... ... > question was more to do with alternatives to the Singleton pattern. ... there are multiple contexts where it can instantiated. ...
    (comp.object)
  • Re: Are Singletons Worth Using?
    ... I am a Java expert. ... >> The Singleton pattern is not about instanciation, ... > 1/ the client class has to know that it is using a singleton because ... The Singleton pattern, as defined in the GoF book, inherently has this ...
    (comp.object)
  • Re: where do I put global data?
    ... IMK, the singleton instance will be created in heap memory, and static class ... > In what ways is the Singleton pattern better for this (I really want to ... >> contain a Globals singleton, a DatabaseManager singleton, a MapPointWS ... >> private static Globals instance; ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: RMI, singletons and multiple classloaders in Weblogic
    ... > singleton pattern in a J2EE environment is not recommended but quite ... the banes of Java Singleton implementations. ... that registry is within the class itself. ...
    (comp.lang.java.programmer)
  • Re: multiple threads?
    ... I was looking at singleton pattern here: http://www.php.net/manual/en/language.oop5.patterns.php#language.oop5.patterns.singleton and it looks that single-threadness is a silent assumption there. ... wouldn't work as a singleton anymore if multiple threads were allowed to execute this code at the same time, ... The PHP development team does not follow this or other newsgroups, ... But don't confuse singletons in an environment where you have no control of memory to that where you do control memory. ...
    (comp.lang.php)