Question: Justification of singleton implementation

Hi there,
I have a question here about using singleton design for process that serves lots of threads in a web application behind a servlet justifies? What sort of impact to the server will be even the implementation of singleton is not targeted on synchronization of I/O within the server?
Thanks

jwenting wrote:
georgemc wrote:
original wrote:
yawmark wrote:
but servlets are all singletons. No, they aren't. Having only one instance of a class -- as is often the case with servlets -- is not the same thing as a Singleton.
is there a reason for this?No, because it isn't true. Stop trolling, daFei.
~i take it that you have no answers.Other than the ones he's given, of course. Silly boy
Steve, best add "a singleton is a class for which you've only created one instance" to the listAnd do remember to pass it around by reference!Heh heh

Similar Messages

  • Migratable targets for singleton implementations

    Hi,
    I require some help regarding the use of migratable targets with singleton implementations
    We have a WebLogic 11g environment comprising several managed servers in a cluster. Migratable Targets are also been defined for JMS and JTA services.
    The deployment includes two EARs which may only be deployed to a single server at any one time. The first EAR contains JARs, a WAR and a RAR. The second contains JARs and EJBs. We wish to implement a fail-over solution for these "singleton" EARs on the cluster so that everything would get migrated to another server in the cluster if the initial pinned server fails.
    We had hoped to use the same mechanism as for JMS and JTA services whereby the EARs would simply assigned to a migratable target (with a defined user preferred server and constraint candidate servers). However from reading the documentation and trying out some deployments this scenario does not seem to be supported by WebLogic. For example, a migratable target may not be given as a target during EAR deployment.
    The only option for the singleton services seems to be inheriting from the SingletonService and deploying this to preferred- and candiates servers but this would mean changing quite a few services and we are not sure how to manage the "singleton" RAR.
    Does Weblogic 11g offer a way to deploy a complete EAR to a deployable target? If not, could you please suggest an alternative way of implementing a fail-over solution for our EARs.
    Thanks in advance for your help.
    Regards. Ian.

    I tried deleting and creating them anew but it then messes up the configuration of the migratable targets. What seems to work now is to delete them, create new ones with DIFFERENT names and then updateDomain(). In this case the old ones get really deleted. Really messy stuff.

  • Question for CRM OD implementation specialist (1Z0-527)

    Please suggest the sample questions for CRM OD implementation specialist (1Z0-527) certification.

    fsitja wrote:
    It seems to me that 1Z0-052 (DBA OCA) was largely based on the 2-day DBA Book already. I fail to see the point of this new path in that case, despite being an OPN-only title (or is it not?).I believe the 2-day DBA exam is based on the equivalent OU course, as for that matter is 1z0-042.
    I think there is equivalent documents are there o match.
    I believe (possibly wrong), the 2-day dba course concentrates on the basics how-to create and manage a database.
    The 1z0-052 (OCA) will also expect more understanding of concepts and basic depth, and in fact some important areas are not really covered until OCP is completed.
    The 2 day DBA exam has been around for some time in 10g .... 1z0-041, though perhaps has not been used heavily as no certification has been based on it. (The exam page for 1z0-041 currently mentions the OPN specialist as an associated certification, whereas [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=143] does not. OCA also requires an SQL exam.
    References:
    [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=143]
    [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_exam_id=1Z0_052]
    [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_exam_id=1Z0_514]
    [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_exam_id=1Z0_041]
    [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=341]
    [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=342]
    ** Please note I believe (IMHO - not authorative merel observant) these pages (and others) may be slightly volitile at the time of this post and subject to alteration for correction minor discrepencies with the introduction of new betas and Oracle Certified Specialist Paths. I believe launch today is tomorrow or something and mediaman and authoriative confirmation may not be available until that time.

  • Singleton implementation for Subject

    Can the singleton pattern be applied for
    javax.security.auth.Subject ?
    I am using the below code
    Subject authSubject = null;
    authSubject = Security.login(UserName, password);
    My question is if it is okay to create the Subject as a singleton and use the same object in subsequent calls? The call Security.login will try to do a login operation. I want to not perform this operation over and over again. Is it advisable to create this object as a Singleton?

    Hi,
        I'm not sure about this. But, the BADI/ES "CRM_MKTPL" does not have the "Multiple Use" set. It depends on filter values and only one implementation per filter value is used.
    Regards,
    Arun Prakash

  • Questions about SAP Note Implementation

    I have never implemented SAP note before. We are on ECC 5.0 and want to implement note 1041579. I looked at the correction instructions for the note and it says
    Prerequisites
    Note                                                             Correction 
    0000795865
    Enh in the FI interface for revenue recognition  0120031469 1  0000455384
                                                                       0120031469 1  0000455385
                                                                       0120031469 1  0000455391 
    I have following questions.
    1. Does it mean that I need to implement note 0000795865 before I implement 1041579, also what do the Corrections mean? Are these some other notes I have to implement
    2. How can I see what notes have already been implemented in the system and which are not?
    Will certainly award points for the right answer

    Hi Srikrishna,
    Does this mean that all these other notes (761173, 847204, 795865) should be implemented before 1041579.
    Ans : There are normally pre-requisities for any note and again that pre-requisite note will have many more pre-requisite notes. It doesnt mean that we have to implement all those notes. See whether that specific note is applicable for the version and package that you are using. Also do a search as I have told you to see whether that note has already been applied.
    Also the prerequisite for 795865 is 847204 how can that be the note number 847204 is greater than 795865?
    Ans : Note numbers doesnt need to be ascending. I am not sure how a note gets its number, but definetly they dont need to be in an ascending order.
    Regards
    Aneesh.

  • Question about java thread implementation

    Hi All,
    I am comparing the performance of the Dining philosopher's problem
    implemented in Java, Ada, C/Pthread, and the experimental language I
    have been working on.
    The algorithm is very simple: let a butler to restrict entry to the
    eating table, so that deadlock is prevented.
    It turns out that the java code is the winner and it is 2 times faster than C!
    The comparison result really surprised me, and raised a big
    question mark : why java runs so fast? I did not use high-level synchronization
    constructs like Semaphores, atomic variables, etc.
    I vaguely recall that Java thread is actually implemented by the underlying
    system thread library(so on linux, the default would be NPTL, on windows NT threads,
    and on Mac OSX it would be Cthread?). Can no longer remember where I read that.
    Does anyone here have some notions about the Java thread
    implementations(where is this formally explained)? or Does anyone know where
    I can possibly find relevant literature or the answer?
    thanks a lot.
    cheers,
    Tony

    Peter__Lawrey wrote:
    google has lots of information on java threaded.
    One thing java does is support biased locking. i.e. the thread which last locked an object can lock that object again faster.
    This may explain the difference. [http://www.google.co.uk/search?q=java+usebiasedlocking]
    Note: you can turn this option off and other locking options to see if a feature is giving you the performance advantage.
    Personally I have found that real world multi-threaded applications are easier to write in Java, esp. when you have a team of developers. For this reason, alot of C/C++ libraries are single threaded, even when there would be a performance advantage in being multi-threaded (because its just too hard in reality to make it thread safe and faster because of it)I didn't know that, very interesting :-)

  • A question about ESS / MSS implementation.

    Hi All,
    Just a brief again about our landscape as:
    1. We have an ERP ECC5.0 system which has J2EE6.40(add-in) without the 'EP' usage type and the present Support package level of the relevant ESS and MSS components are as follows:
    a. J2EE6.40 Support Package level is '17'.(We are going to deploy the XSS components here)
    b. ERP ECC5.0 system's Software Components details are as follows:
    SOFTWARE COMPONENTS RELEASE LEVEL HIGHEST SUPPORT PACKAGE APPLIED
    SAP_BASIS 640 0016 SAPKB64016
    SAP_ABA 640 0016 SAPKA64016
    SAP_APPL 500 0009 SAPKH50009
    SAP_HR 500 0019 SAPKE50019
    EA-HR 500 0005 SAPKGPHC05
    2. We have a separate NW2004s(Dual stack(ABAP7.0+J2EE7.0) installation having EP7.0 with Support Package level is '16'. (We are going to deploy the Business Package for ESS & MSS here).
    Here are my questions?
    1. what is the best 'Support Package' level recommendation or combination is applicable for all the components(J2EE6.40,SAP_BASIS,SAP_ABA,SAP_APPL,SAP_HR,EA-HR...etc.,) involved in this type of mixed landscape - ESS & MSS implementation?
    2. If we apply the higher Support Packages 'only' for the ERP ECC5.0 software components such as: SAP_BASIS,SAP_ABA,SAP_APPL,SAP_HR,EA-HR - what other ERP ECC5.0 software components would get impacted from functionality prespective ?(let us say if we keep the current Support Package level for other software components as untouched)
    3. Is there any dependency exist from the Support Package point-of-view between the ESS MSS Business Packages and with XSS components(PCUI_GP; ESS; MSS)
    4. Is there any dependency exist from the Support Package point-of-view between XSS components and ERP ECC5.0 software components such as "SAP_BASIS,SAP_ABA,SAP_APPL,SAP_HR,EA-HR"
    Kindly address my above concerns.
    Regards,
    Vijay

    Hi Vijay
    To answer your questions
    First you should check note 1007341 which helps consultants proposing this type of landscape
    To answer some of your questions
    1) For SPs you have to patch ERP 2004 components following ERP 2004 stack and patch
        ERP 2005 components following the ERP2005 stack recommendations at www.service.sap.com/sp-stacks
        in terms of equivalence levels I would select SP levels from each stack with similiar release dates
    2) Presumably you will be using ERP2004 components in the front-end in some capacity therefore these
        ERP2004 components must be patched in line with ECC 500 stacks
    3) There is dependancies between Business Packages and XSS
    4) There is dependancies between back-end components SAP_HR and EA_HR and XSS/BP
        SAP_HR and EA_HR also have their own dependancies with the other back-end components listed
    Best wishes
    Stuart

  • Design question - best order of implementation

    Please see attached an existing core network infrastructure design. I am planning to implement the following:
    1. A secondary DMVPN hub (dual DMVPN hub)
    2. A secondary ASA (active/active configuration)
    3. A secondary ISP (BGP multihoming)
    What would be the best/right order to start implementing these technologies?
    Thanks,

    Hello jimiohara,
    jimiohara wrote:
    The question I have is what would be the best way to store these constant parameters as strings so they can be retrieved using a single identifier such as the graphs type or class name(bearing in mind there are about 20+ different graphs)?I am not really sure, whether I understand the question right? But why not using a hash table (e.g. HashMap). In this key/value-list you can store whatever you like. The key only have to be "hashable" (implement equals() and hashCode(), e.g. String!!!). If you want to use TreeMap you also have to define an order with Comparable or Comparator.
    Or use the Properties-class where the key and the value are always Strings.
    regards
    tk

  • True singleton implementation

    Am I correct in believing that an implementation of the Singleton pattern cannot guarantee the existence of at most one instance of a class across an entire JVM if it uses only simple Java constructs? I understand that the ClassLoader framework allows a class to be loaded several times by different ClassLoaders.
    By simple constructs I mean the ClassLoader hierarchy and class initialization and avoiding an "external" service (RMI or other).
    I ask because I am trying to implement a file locking procedure. I can guarantee lock exclusivity between JVMs using java.nio.FileLock. However, I am worried that I cannot guarantee exclusivity between Threads within the same JVM (using a classic singleton pattern) - only between Threads with "similar" ClassLoaders.
    - Andy

    Thanks for your replies everyone.
    You could test for the class loader and refuse to
    load unless it is the system class loader.How would I do this?You need to test for it in a static initializer.
    >
    It there a simple way to guarantee that this class
    will be loaded by the system class loader or does
    each class that references it have to be adapted
    apropriately?
    You test it in a static initializer and throw a runtime exception if the system class loader is not being used.
    This also means that the Singleton class needs to be
    found in the system class path - this seems like
    pretty ugly solution - especially if we're in a J2EE
    container...If you are loading via the system then you are already outside the container.
    >
    Also, I cannot find anything that clearly states that
    there is only one system class loader. Is this the
    case?No idea. If this is of concern to you then perhaps you should actually look at why you really need this sort of thing in the first place.

  • LVOOP class Singleton implementa​tion

    Hello all,
    I am trying to implement a 'Singleton' class because I want multiple threads to be able to access the class data.  
    I do have a scalablity concern regarding the class data.  Currently,
    the class data control (cluster) has four array elements.  I plan to
    use one  private (write) method .vi for each data element since I don't
    want to have to update all four arrays.  If I want to added other
    controls (numeric, boolean, array, etc.) to the class data control, I
    will have to create additional write methods and (at least) modify the
    read method.
    Is there an easier way to scale this data?
    I'm using LabVIEW 8.20.
    Regards,
    Mark
    "There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal

    One new feature of LV8.5 was the ability to automatically create accessors for private class data, saving you time for a normally tedious task.
    And if you implement a Singleton pattern along the lines of the Discussion Forum post I mentioned, adding data accessors is no more difficult for the by reference case than it is for the by value case.
    Are all the arrays in your cluster the same type? If so, you could make your data a little more dynamic to facilitate on flexible accessor VI instead of one for each array. For instance, instead of a cluster of four arrays, you could have one 2D array, where each row represents one of the arrays. Then your accessor takes in the array index to get, and retrieves that row from the 2D array.
    The downside there is that all of the rows have to be the same length, so the shorter arrays will get padded. To get around that, you could have an extra array in your private data that denotes length, with one element for each row. Then you take a subset of the array when passing it out. Or you could have a 1D array of clusters that contain one array in them. Then the arrays in the clusters don't have to be the same length as each other. This is a common way to handle this situation in LabVIEW in general.
    Jarrod S.
    National Instruments

  • SIngleton Implementation

    Hello, I am solving exercises Think in Java by Bruce Eckel said so and the problem ..
    Create a class called ConectionHandle which operates a Fixed Object Array Connection. The developer client should not be able to create objects Connection explicitly, but can only create objects through a static method of ConectionHandre. When ConectionHandre loses objects return a null reference. Try class main .. Tip .. Use the pattern Singleton
    package c05.patrones;
    class Connection{
        //private Constructor
        private Connection(){
            System.out.println("Created Instance");
        static Connection getInstance(){
            return new Connection();
    public class ConnectionHandre {
        static int instances=5;
        static Connection[] Cons = new Connection[5];
        static Connection getInstance(){
            if(instances<1){
                return null;
            }else{
                instances--;
                return Cons[instances].getInstance();
        public static void main(String[] args) {
            ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
              ConnectionHandle.getInstance();
        }The output of this is..
    Created Instance
    Created Instance
    Created Instance
    Created Instance
    Created InstanceIt�s ok my implementation or what happend, please help me, thnks a lot..

    Your implementation is write....Its in your code
    static Connection getInstance(){
            if(instances<1){
                return null;
            }else{
                instances--;
                return Cons[instances].getInstance();
        }which tells that as soon as the the index of the array reaches less than the lowest limit that is the first index you should not return any more new instance but in turn return a null reference therefore after calling the newInstance for five times the static counter reduces to zero and returns back to u null

  • Question: How can I implement check box in workflow?

    Can I implement check box, drop down menu etc in workflow?

    Hi,
    There is no quick and easy way to do this.
    Although the OA Framework / PL/SQL document approach to a dynamic notification is only intended to be read only rather than bi-directional, it can be used to provide this kind of functionality.
    Once the fields have been completed, you would need to include a custom mechanism to respond to the notification (by calling WF_NOTIFICATION.respond), rather than having the users use the standard buttons.
    I've done similar with PL/SQL documents in the past - rendering the contents how we needed them to, and then essentially having an HTML form submit which invokes a PL/SQL procedure passing the values selected as parameters. The code then does whatever it needs to do, and responds to the notification by calling the appopriate API.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://www.workflowfaq.com/blog ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • Ok, easy question...About implements and extends

    Im sure this will be simple to all of you, but I am still new to the Java language. I want to know the difference between using "extends" and "implements" in the way that its used in these examples:
    With the "extends" keyword...
    class PrimeThread extends Thread {
             long minPrime;
             PrimeThread(long minPrime) {
                 this.minPrime = minPrime;
             public void run() {
                 // compute primes larger than minPrime
         }And then with the "implements" keyword...
    Using the interface "Runnable"
    class PrimeRun implements Runnable {
             long minPrime;
             PrimeRun(long minPrime) {
                 this.minPrime = minPrime;
             public void run() {
                 // compute primes larger than minPrime
         }Can someone please explain when you would want to use the "extends" version and when you would want to use the "implements" version? Sorry for practically insulting your intelligence...I'm just trying to learn this language without a book as an experiment to see (how much/how fast) I can learn purely using the web resources...Thanks to anyone who wishes to explain this to me.

    That's pretty much it.
    An interface may extend zero or more other interfaces.
    A class (except Object) always extends exactly one other class--either the class explicitly named with "extends", or Object if "extends" is not present.
    A class may implement zero or more interfaces.
    "Extends" implies a parent-child relationship. Interfaces extend other interfaces, and classes extend other classes.
    "Implements" implies a contract stating that the class will provide implementations for all the methods declared in the interface (or the class will be declared abstract). If a class implements A, and A extends B, then that class must implement all methods declared in A and all methods declared in B.
    Does this help?

  • Question about synchronized singleton classes

    Hi,
    I have a singleton class, with only 1 method (which is static), I want access to that method to be synchronized, but someone suggested that I make my getInstance() method synchronized as well.
    Is this neccessary, or is it overkill?
    thanks!

    Example:
    static Instance getInstance() {
    if (instance == null) {
    instance = new Instance();
    return instance;
    }Two threads call it simultaneously:
    1. if (instance == null) { // evaluates true
    2. if (instance == null) { // evaluates true
    1. instance = new Instance(); // first instance
    2. instance = new Instance(); // second instance,
    deleting the reference to the first instance
    1. return instance; // which is not the originally
    created one but the second instance
    2. return instance;There's actually a worse consequence.
    1) T1 sees null
    2) T1 sets instance to point to where the object will live
    4) T2 sees non-null
    3) T2 returns, with a pointer to what's supposed to be an object, but isn't yet inited.
    4) T1 eventually inits the instance
    This can happen even if you use the "double check locking" pattern of synchronization.
    At least under the old memory model. I think the new JMM in effect in 5.0 (and possibly later 1.4) versions fixes it. I don't know if the fact that it can happen in absence of sync/DCL is an error or not, so I'm not sure if that's addressed in the new JMM, or if it's only the synced case that was a bug. (That is, it might be okay that it happens without syncing.)

  • Questions about your OBIEE implementation

    What size of team manages your OBI implementation?
    How many users do you have? How do you find performance?
    How did you manage OBI training?
    Unexpected surprises (good and bad)
    Major benefits of the system
    Major limitations of the system
    How do you handle Production Control/Changes to Common Information Model?)

    Hi Srikrishna,
    Does this mean that all these other notes (761173, 847204, 795865) should be implemented before 1041579.
    Ans : There are normally pre-requisities for any note and again that pre-requisite note will have many more pre-requisite notes. It doesnt mean that we have to implement all those notes. See whether that specific note is applicable for the version and package that you are using. Also do a search as I have told you to see whether that note has already been applied.
    Also the prerequisite for 795865 is 847204 how can that be the note number 847204 is greater than 795865?
    Ans : Note numbers doesnt need to be ascending. I am not sure how a note gets its number, but definetly they dont need to be in an ascending order.
    Regards
    Aneesh.

Maybe you are looking for

  • Error invoking web service in 10.1.3.0.4

    Hi, Has any one encountered this problem or have an idea what to do about it? When I try to invoke a web service that executes a PL/SQL function that returns a ref cursor,if the select statement joins tables that are in more then one schema, then inv

  • Oracle 8.1.6 for NT installation error

    Hi, I have oracle 7.3 client installed on a NT server. I then installed 8.1.6 in a different directory. The installation hit an error on ms???.dll file. By ignoring the message, the installation is successful. I can connect to a Oracle database serve

  • PDF Portfolio

    I have created a portfolio compiled of fill-in forms and other documents.. When I open a document within the portfolio that has multiple pages, the pages get jumbled up. I've noticed that it is happening with page two - so if double click a document

  • CS4 Installation issues on New Mac

    I am a CS4 user. My computer died and I need to load CS4 onto my newer Mac OS X v 10.7.5. I am having trouble with the installation from the original discs. Any suggestions?

  • How to return multiple tags (based on different checks) in a for loop?

    Hi, I'm trying to return multiple elements, based on different checks that are done in the XQuery, within a for loop. But I'm getting syntax errors at any attempt to do this. This is the structure of what I'm trying to do:           <ActionList>