Do I have one instance of a method

I create a class and define a staic method
then I call it in JSP
<%
Myclass class1=new Myclass();
class1.StaticMethod();
%>
When a lot of people visit my JSP page
I have only one instance of StaticMethod()
or many of it?

// Myclass .java
public class Myclass {
static Object testObj=null
static void StaticMethod(){
if(testObj==null){
System.out.println("=null");
testObj= new String("123");
else{
System.out.println("not null");
then I call it in JSP
<%
Myclass .StaticMethod();
%>
So Only first time Who visit it print "=null";
Other visitor only received it print "not null";
Is it mean all Visitor share one
StaticMethod() ?

Similar Messages

  • Have one instance on linux running one database.can i create more databases to sam

    i have one instance on linux running one database.can i create more databases to same instance and they all remain up .

    you can create more than one database (Instance) on the same machine, start up all of them, in the connect string write the Instance name you want to work with.
    null

  • Best way to have only one  instance of an object in web application.

    Hello,
    I defined a class that provides services to my web application: subscribes user, check if user already subscrubed etc. The objects don't need to save any session information. So it is like a Stateless Session Bean (from what I've read about Session beans).
    The webapp is small and I don't want to use EJBs.
    What would be the best way to have one instance of the above class in my webapp ?
    Would making the class static be a good method ? Using a factory ?
    Is there a way to put in web.xml something that asks the container to instantiate an object that is not a servlet and place it in Application scope, so that I cann retrieve it whenever required in my app ?
    Other suggestions ?
    Thank you,
    Vlad.

    Hi
    The best way to have only one instance is use the singleton pattern. The idea is : the class has a private
    contructor, a public static method that returns an instance of this object and a static member that is false if not any instance and true if there si an instance.
    To obtain one instance you can do some like
    MyObject ob=MyObject.getIntance();
    this method inspect the static member and returns null if true. If false set to true and return the object
    via the private constructor.
    You can lear more at book of Gramma .... (gang of four)
    Hope this helps

  • One instance for two different application

    Hello,
    I have to solve following problem..
    need have one instance of object for two different application..fist is standard SE application and second is EE (web)..
    SE application is a server..listen on and accepting connection from mobile phone..and EE application need to show list of connected devices and should say to SE application that new device was connected..
    I would like to do this without database..only server and web app..
    I have thought about RMI..but hope there is more simple solution..
    Thanks a lot for your ideas.
    Dmitrij

    I would like to do this without database..only server and web app..You have your reasons for wanting this to be the case. If you are sure you don't want a DB, then pass the state of the object between the two ends using XML as the transport form. As someone said, you can use JMS or you can write an HTTP POST or probably other transport mechanisms other people will suggest to actually get it over the wire from one side to the other.
    As to your question of how to sync state, just make the object you're sharing final after it's been created (on the side that creates it) and make the reference that receives it and holds it final also, after you've reconstructed it from the XML you received.

  • New to Mainstage but I have one question.

    Hi guys,
    I'm new to Mainstage, but not to Logic.
    Anyway, I have one rather complicated question before I dig though all the manuals.
    Here is the set up that I want to achieve. My buddy has an I-Mac, I have a MacBook. What we have been doing involving logic is that I have 3 Guitar rig 4's going. A stereo pair for each Guitar rig. I am able to switch between the rigs with a single guitar input. While in each rig I use my FCB 1010 controller and make loops. After a loop is made I switch to a different guitar rig and make a 2nd loop. After that I go to the 3rd guitar rig and play leads over the first 2 loops. These are all going to separate tracks in my firnds I-Mac where he has drum machines going and he is playing his keyboards. We record all this in real time. Logic can sort of handle this, but not really all that well and I get some strange behaviors.
    In Mainstage, I know you can use the mobius looper which is similar to the Gibson Echoplex that I used to own. The mobius doesn't work too well in Logic so that's why I don't use it there. It doesn't sync in Logic, but I think that it might in Mainstage. What I want to do is have one instance of guitar rig and 2 to 3 instances of the mobius looper.
    Here is my question finally. Can I use my FCB1010 to control the distort, delay, and other various effects in Guitar rig 4 while playing loops in a Mobius looper. Then move to another looper, play more loops, then go the 3rd track and play over the loopers? I would need separate outs for each looper or guitar track, which I have with my Presonus Firebox. The whole time I would need to sync Mainstage with my friends master clock coming out of his I-Mac.
    Can this be done?
    I know it sounds like a complicated set up, and maybe it is, if there is an easier way that has sync of the loopers, and I can run hands free with my one guitar, Presonus interface, and Behringer FCB1010 I would really like to know.
    I find for some reason that I have crazy set ups that nobody has ever tried before. I'm hoping that is not the case with this.
    Thank you for reading my long winded post and I hope to hear from you soon.
    Shawn

    Well, are you using the looper tool in mainstage, or a different looper?
    I'm thinking that there is a way to us guitar rig as my main sound source and route into other tracks (bussing it over) and have loopers enabled in those other tracks. That way I can lay down a rhythm in one track, move to the next track, do the same looping with a different guitar patch, move to the 3rd track and play with even a different sound while the other loops are going in the first two tracks.
    Is that what you do? Do you play live and have synced to another source?
    Thank you,
    Shawn

  • I am trying to purchase an app and update my apps all are free but it won't accept my security code, all itkeeps saying is that my payment method has been declined, I only have one card so can't try another

    I am trying to purchase an app and update my apps all are free but it won't accept my card, all it keeps saying is that my payment method has been declined, I only have one card so can't try another. Now I can't use some of my apps because they are waiting to be updated. Somebody please help!!

    Hello Sriggers,
    Welcome to the Apple Support Communities!
    I understand that you are attempting to update some applications on your iPhone but the payment method was declined. In this situation, I would recommend reading over the information in the attached article to help resolve the situation. 
    Pay an unpaid balance in the iTunes Store - Apple Support
    Best,
    Joe

  • Hello..i use firefox 4 beta 05..my question is..why when i open let's say 6 tabs..my windows show that i have 6 instancies of firefox instead of one like it does with firefox 3.6? thanks

    hello..i use firefox 4 beta 05..my question is..why when i open let's say 6 tabs..my windows show that i have 6 instancies of firefox instead of one like it does with firefox 3.6? thanks
    maybe i am saying it wrong..when i press alt+tab there is only one firefox open..but in windows 7 in the taskbar..every tab open..appears as another window open

    If you are referring to taskbar previews, you can turn them off by modifying a hidden preference.
    # Type '''about:config''' into the location bar and press enter
    # Accept the warning message that appears, you will be taken to a list of preferences
    # In the filter box type '''previews'''
    # Double-click on the preference browser.taskbar.previews.enable to change its value to '''false'''

  • My previous method for payment on itunes was debit card but now I dont have one.  How do I change to no card without creating a new apple id

    My previous method for payment on itunes was debit card but now I dont have one.  How do I change to no card without creating a new apple id?  It tells me to update payment details when I try to update apps but it only has visa, mastercard, amex and maesto.  I dont have any of them.  I did previously use visa but I dont have the card anymore and cant get another one.  Please can someone help me set it up so I dont need a payment method.  Thanks

    Thanks for you reply.  Is that the only way as it would cost me £15?

  • Can one instance have multiple redo threads ?

    i was reading the Oracle Data guard 10g guide and it says
    Determine the appropriate number of standby redo log file groups.
    Minimally, the configuration should have one more standby redo log file group than the number of online redo log file groups on the primary database. However, the recommended number of standby redo log file groups is dependent on the number of threads on the primary database. Use the following equation to determine an appropriate number of standby redo log file groups:
    (maximum number of logfiles for each thread + 1) * maximum number of threads
    Using this equation reduces the likelihood that the primary instance's log writer (LGWR) process will be blocked because a standby redo log file cannot be allocated on the standby database. For example, if the primary database has 2 log files for each thread and 2 threads, then 6 standby redo log file groups are needed on the standby database
    while Oracle's definition of redo log states the following
    Redo Threads
    When speaking in the context of multiple database instances, the redo log for each database instance is also referred to as a redo thread. In typical configurations, only one database instance accesses an Oracle Database, so only one thread is present. In an Oracle Real Application Clusters environment, however, two or more instances concurrently access a single database and each instance has its own thread of redo.
    this is confusing, in a typical environment where only one instance accesses a database, can we have more than one redo thread ?

    Though you can create multiple threads but of no use in NON-RAC or non-parallel server configuration.
    Following is the generic formula. You should consider
    maximum number of threads = 1 for single instance (NON-RAC).
    (maximum number of logfiles for each thread + 1) * maximum number of threads
    Message was edited by:
    Reega

  • How can I have one thing open in Safari on my MacBook Pro and search for another thing in Safari without closing out of the other? For instance, How can I leave Pandora playing while I search Facebook?

    How can I have one thing open in Safari on my MacBook Pro and search for another thing in Safari without closing out of the other? For instance, How can I leave Pandora playing while I search Facebook?

    With Safari open use the Command + T keyboard shortcut to open a new tab.
    Or, Command + N to open a new window.

  • I want to transfer my iPhoto from my old MacBook Pro to my new MacBook Pro. I have a firewire or I could also do it from my TimeCapsule. Would one be a better method than the other?

    I want to transfer my iPhoto from my old MacBook Pro to my new MacBook Pro. I have a firewire or I could also do it from my TimeCapsule. Would one be a better method than the other?

    Hi brotherbrown,
    A direct FireWire transfer (especially if it's 800 to 800) is going to be the fastest method. TimeCapsule would work, if you connect to it via Ethernet, via wireless it would be quite slow (especially if you have a large library).

  • Every application must have exactly one instance of UIApplication...

    From documentation...
    ""Every application must have exactly one instance of UIApplication (or a subclass of UIApplication )" .. none of the templates in the SDK create an app with an UIApplication instance or subclass that I can tell."
    Yet, in all three sample templates I can't find any instance or subclass of UIApplication.
    Creating a new Cocoa Touch Toolbar Project...the closest thing is:
    @interface Untitled2AppDelegate : NSObject <UIApplicationDelegate> {...}
    Does using the <UIApplicationDelegate> ake the NSObject an instance or subclass of UIApplication? Why not use
    @interface Untitled2AppDelegate : UIApplication {...}

    Check the main.m file. It should have a line something like this in it:
    int retVal = UIApplicationMain(argc, argv, nil, @"Untitled2AppDelegate");
    The UIApplicationMain function is creating a UIApplication instance internally and setting its UIApplicationDelegate to your custom delegate.
    The 3rd parameter specifies the name of the UIApplication class you want to use. Passing nil defaults to the normal UIApplication class, but if you needed to use a custom class derived from UIApplication, you could pass its name in there. More than likely, though, the UIApplicationDelegate interface gives you access to everything you need.

  • Can you have more than one instance of Essbase 11.1.2 on the same server

    we have a instance of 11.1.2 Essbase on a server that is up and running for production
    what is the process of setting a development instance on the same server, or do we have do a complete install on a different server
    Please advise
    Roger H Hicks
    [email protected]
    Edited by: Next Level on Sep 19, 2010 10:25 AM
    Edited by: Next Level on Sep 19, 2010 10:32 AM

    Have a read of :- http://download.oracle.com/docs/cd/E17236_01/epm.1112/epm_install/ch04s09s09s03.html
    It will explain how to have multiple instances of essbase.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • I have two instances of plugin container shown running in Task Manager. Is one malware of some sort?

    No crashes to report. Windows 7 64 bit; Firefox 3.6.10; Previously have battled the two instances of Firefox running and finally beat it back after multiple virus scans by multiple AV products. Now I have two instances of the plugin container shown.
    Googled with out success and finding anything.

    No crashes to report. Windows 7 64 bit; Firefox 3.6.10; Previously have battled the two instances of Firefox running and finally beat it back after multiple virus scans by multiple AV products. Now I have two instances of the plugin container shown.
    Googled with out success and finding anything.

  • Cannot run more than one instance of a remote app in remote desktop services Server 2012

    All,
    I installed "Remote Desktop Services (RDS) Quick Start Deployment for RemoteApp, Windows Server 2012 Style" using the instructions here http://blogs.technet.com/b/yungchou/archive/2013/02/07/remote-desktop-services-rds-quick-start-deployment-for-remoteapp-windows-server-2012-style.aspx
    I need to set up an image viewing program (Olyvia) to allow students using Macs and iPads access to this windows only application in order for them to get their work done.  We may have 12 or more students accessing and trying to run the Olyvia application
    at any one time.
    All works good, except that I cannot run the Olyvia application (setup as a remoteapp program) more than one instance at a time.  That is, when I start up "olyvia" on a Mac, it works great.  If I leave it up and running, and then try
    and start up "olyvia" on an iPad (using different accounts), I get the following error message:
    "Cannot run more than one instance of this program simultaneously.  Either the program is already running, or it has not been terminated completely."
    I need to understand the root issue.
    1.  Is this a licensing issue?  So, I need to add some CALs to the RDS server?
    2.  Is this a application issue with "olyvia"?  So, no matter what I do, it is not going to be able to be used by more than one person at a time when configured as a remoteapp?
    3.  Did I not "publish" the application correctly?
    4.  Is this happening because I followed the "quick start" guide?
    Appreciate any help I can get on this.  We have no problem getting CALs, I just need some help with the root issue.
    Thanks,
    Geoff Weatherford
    CVMBS, CSU

    Hi Geoff,
    Each application uses different techniques for determining if multiple instances are running.  If you can determine what method it is using then perhaps you could use App-V or other virtualization software.
    In the best case you really should direct your question to the maker of Olyvia.  The reason I said that is they specifically designed their software to prevent multiple instances, so the first question is, why?  Is it related to Licensing? 
    Compatibility?  If you knew the specific reason(s) why they are doing it and the technique used then at the point using a virtualization technique may be the best option.
    -TP

Maybe you are looking for

  • I have multiple users & devices on my apple account. How do i set up icloud so we can have our own emails?

    I have multiple devices$ users on my apple account. How do I set up icloud so that we can have our own emails?

  • How to add a standerd infotype infotype (eg IT1000) in PA40 ?

    Hi Seniors, 1.  When I try to create a relationship in PA30, it shows 'No infotype exist for corrector string 100' (it shows the same if I try any OM IT). I tried to create 1001 in PA >> Customizing Procedures >> Infotypes but it shows "choose the ke

  • Ipad bought in China to be used in Italy

    Dear All, I tried to find a discussion to answer my question alone but I didn't find the similar discussion, so sorry in case of the solution already exists. I'm Italian and a Chinese guy friend of mine would send me as a present an Ipad3 (new Ipad)

  • BPM - BPE_ADAPTER errors

    I am trying to follow Arpit's blog for the RFC Scenario using BPM --Starter Kit /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit I am getting the following error in Call adapter <SAP:Category>XIAdapter</SAP:Category>   <SAP:Code

  • Part-appraisers for 360 Feedback

    Hi guys, Have anybody ever had to treat different part-appraisers in a 360 feedback process? My client needs some different types of part-appraiser: subordinated, pair and internal customer (and also self and manager appraisals). All these “types” of