Can i use singleton for storing current login id

hello,
can i use a singleton for storing login userid temporarilary for application lifetime. Is there any issue if more than 2 users login at the same time as the singleton object will be static ! ..

let me ask more precisely..
is there anything of concern if i run my program(involving statics) by 2 jvm instances.
public class Demo extends Thread
     static String[] myargs ;
     public static void main(String args[])
          myargs = args;     
          try
               Demo.sleep(5000);
          catch(InterruptedException e)
          System.out.println(myargs[0]);
}look at the pre code...what if i try to run it by using 2 command promptS
giving different aruements (a bit quick)
Edited by: rajat on Dec 28, 2007 7:14 AM

Similar Messages

  • How can I use JDesktopPane for storing components?

    Hi there!
    I want to write an app which uses JNI, but I need to store widgets into the JDesktopPane , so that this Pane is always visible, not minimazable and has no decoration.
    Is this possible at all, because as far as I know .add(Component c) only adds new JInternalFrames?
    Or is this possible with an JInternal Frame to use all the space, being always in background and to have no Windows-Decorations (above the JInternal Frame)
    I hope you can help my,thanks for reading!
    Mfg Clemens

    Why do you need to use a JDesktopPane? If all you want is a pane with components on (no menu bar, title bar etc) then you can use a JWindow.
    N35Sy

  • ResultSet - Can I use one for storing another RS?

    I'm wondering wheter or not I can create a ResultSet object (rs3) to store my Resultset rows from a query (rs1) while I'm checking the contents of it (rs1) compared to the contents of another Resultset (rs2)?
    Like this:
    I have two DB's that I'm querying in the same way (I give them the same question). The answeres aren't the same, and they shouldn't be either (the resultsets aren't the same from DB1 (rs1) and DB2 (rs2)).
    A similar thing illustrated in pseudo code:
    I compare the two resultsets in a specific column (rs.getSTring("phoneNo")).
    Then I compare
    if rs1.phoneNo.equals(rs2.phoneNo)
    print rs1
    else
    rs3.add(rs1); // This is where I have problems, is this possible?
    So I guess the question is; Can I store rows from a resultset in a new (That's NOT created for a query) resultset and then later use these and still get all the information out of it?
    I apprechiate any help or thoughts on this.
    Elin

    A ResultSet is not a set of results as the name suggests. A ResultSet only stores one row at a time and can get the next value as required. In this it is similar to an Iterator.
    If you want to store a ResultSet, use a collection such as a LinkedHashMap() where the key is the primary unique key and the values are the values for a given row.

  • Can I Use Singletone  Pattren for DAO in Stateless EJB?

    Hi friends,
    I have a design in which i am creating an Business Layer using EJB (Stateless). In my case i have only read only to DataBase and at one case where i will be updating the database. But my application will be accessed by many concurrent users.
    My problem is if i create a DAO with singleton pattren then it will be returning the same instance to all the person who access the DB. So if one person is reading the database and at the same moment one more person request for update since the DAO is singleton object will there be any conflict?
    Reply soon

    Hi Martin.S
    Thanks for your suggestion.
    U Asked
    You need to think about why have you have made your DAO a Singleton. You need to ask yourself, SHOULD it be a Singleton? It may be valid decision but I find that doubtful. Singleton DAO's suit only limited set of circumstances. Why i decided to use singleton pattren was :
    Since i am using session bean and if i won't use Singleton pattren and
    If my app was used by say 1000 users
    Then 1000 Dao instaces whould be created!
    The App Server will have 1000 refrences which may be a performance issue and may slow down the server due to more usage of server resource. So i need to know weather is it a good idea to use the Singleton pattren for DAO when using SessionBeans?
    And one more doubt I have Martin
    If i use One Dao Class Per One Table Then How about the factories if i use singleton? Need to create so many factories as DAO's? *reply
    Also i think if i use Single DAO per Table and if i have say 1 user accessing the DAO and he is in the Middle of his execution and user 2 requests for the same DAO once again the situation is worse! Am i right?
    So I think Singleton pattren comes into handy only when one person is accessing the DAO at a time. After he completes then only we can give access to some one else.
    And also while Using EJB's Using syncronized DAO is not preffered since EJB's are for multiple access
    So do you have any solution for the same? Currently I am using ordinary DAO and creating multiple instances in the Session Bean.
    Is there any way to Use SingleTon Pattren inside SessionBean?
    Reply
    A Singleton DAO would be valid choice when you are doing performance/throughput optimisation for read only access to dataset which you have cached for speed, but need to ensure only one copy exists for memory efficiency.One more query martin,
    How can we use it for read only access to a data set?
    For example i have a DAO which queries and returns some result sets based on some input value given by the user
    Now take a senario1: User1 supplys some input value and executes method1() and he is in the middle.
    User2 comes in and acess the same method1() with different input value
    Since it is a SingleTon Pattren The User2 will get same refrence
    So user1 will get the result set that is having the input parameters of user2. Right?????????
    So my inference is we cannot use singelton pattren for concurrent acess of the DAO.What do you say
    Please Reply Martin

  • I have an apple id but ı can not use it for sign in to itunes connect account while publishing my ibook document. Why ı can not login? What can ı do to figure out this problem?

    I have an apple id but ı can not use it for sign in to itunes connect account while publishing my ibook document. Why ı can not login? What can ı do to figure out this problem?

    As note already on the iBA forum [ AppleID for ibooks publishing ], you need two IDs. You can't use your developer ID.
    If you already signed up for books with that ID, you need to talk to Apple to straighten things out.

  • Can't use keypad for IVR during call

    When I am in a call talking with an IVR system (the one that ask you to type numbers to select options), but keypad does not send these numbers out.
    Instead it show them on the screen to allow me to use them for storing it as a new phone number.
    How can I "tell" it to send them on the call?
    I'm using X2 (with Hebrew S40 OS)

    thanks, it worked, but the interface is very complicated, as I need to pass via few IVR selections, it is complex to go to this option every time.
    Is there an option to make this the deafult way the phone will work? So every time I'm on a phone call and click a number it will be sent to the IVR system without the need to go to the DTMF menu

  • Can I use JMS for this?

    User logs into our administrative console, selects a job, clicks run.
    Behind the scenes, the run command actually creates a job and returns XML which provides a long list of commands that need to be executed in order for that "job" the user triggered to be complete. This XML contains everything from shell scripts that need to be triggered to PL/SQL functions and stored procedures that need to be called...and they're listed in this XML file in the order they need to be executed and the next process in the list can only be executed when the process before it is finished. This all needs to go on behind the scenes, uninhibiting the user's experience on the website...so that's why I thought I might be able to use JMS but it seems everything needs to be written in java for this to work, which is a problem being I need to trigger runtime processes on the Linux box to execute shell scripts, which are not written in java...how would those shell scripts communicate with the JMS?
    Anyone doing anything like this? Examples somewhere? It's kind of like a job management console...the jobs are pretty complex and can take up to 45 minutes or more to complete, which is why we need to come up with a way to run them from the app server, but in the background, asynchronously from the user's website utilization. This obviously, because of the time some of these take to complete, can't be a request/response architecture...
    Thoughts? Help? Anything greatly appreciated.
    Thanks!
    rlb

              poorni wrote:
              > Hello everyone,
              > I need to send an alert message from the client to a server(which is
              > remote). Can I use JMS for this?.
              Yes.
              If so can anyone please suggest me
              > an open source JMS provider.
              WebLogic has JMS built-in.
              > Thank you,
              > poornima
              

  • How can I use TopLink for querys that have two and more tables?

    I use TopLink today, and I can use one table to query, but how can I use TopLink for querys that have two and more tables?
    Thank you for see and answer this question.

    You can write a custom SQL query and map it to an object as needed. You can also use the Toplink query language "anyOf" or "get" commands to map two tables as long as you map them as one to one (get command) or one to many (anyOf command) in the toplink mapping workbench.
    Zev.
    check out oracle.toplink.expressions.Expression in the 10.1.3 API

  • How can I use OCCI for oracle8.1.6?

    my database is oralce8.1.6 for solaris8.
    I want to develop database application by OCCI .
    But only oracle9i has OCCI.
    How can I do?
    Where can I get OCCI ,and how can I use it for oralce8.1.6?
    thank you very much!!

    OCI is available for all versions of Oracle including Oracle
    7/8/8i etc. However it is not installed by default with these
    versions. I am assuming that the default 9i installation
    includes OCI. You should be able to install OCI for other
    versions through one of the development platforms e.g. ProC/C++
    etc.

  • How can i use AME for the new OAF page.

    Dear all,
    I have developed a new OAF page and registered under Employee Self Service.
    How can i use AME for the approval process.
    Appreciate your ideas?
    zamora

    I will try to answer based on my experience of working with iProcurement and AME. It depends on how you want to make a call to AME , directly from OAF Page or from Workflow and your requirement. You didn't specify what you want to show the users on OAF Page and your business requirement.
    Before calling AME Engine from the OAF page or workflow, I guess you did already setup AME Transaction Type and it's Approval Groups, Conditions, Action Types and Rules. Do some testing from AME Business Analyst Test Workbench. Please note that, AME provides lot of PL/SQL API's that you have to call from your programs (java or workflow pl/sql)
    Let's look at the workflow and putting an OAF Page as notification.
    As Sameer said, you have kick-off workflow process from PR of CO and with in the workflow function, you make a call to AME Engine API's with the AME Transaction ID. This transactionId belongs to the AME Transsaction Type that you setup. Based on the rules setup, AME Engine generates list of approvers/approver and stores them AME Tables for that transactionId. Then, it sends a notification to the approver.
    In the workflow, where that notification is defined, in the message body you have to put an attribute(&XX_WF_FWK_RN) of type document/send. And this attribute will have the constant JSP:/OA_HTML/OA.jsp?OAFunc=XX_FUNC&paramId=-&DOCUMENT_ID-. This function is SSWA Jsp function that makes a web html call to your OAF Region.
    If your requirement is to just show the list of approvers on the OAF Page, you may have to call AME API diectly passing your AME TrasnactionId with other parameters. Then AME generates list of approvers and stores them in AME tables with each approver status. You can pickup those approvers using VO and show them on OAF Page.
    Hope this gives some idea.

  • How can i use RTFEditorKit for JTextField.

    hi all,
    how can i use RTFEditorKit for JTextField.
    thanks in advance
    daya

    Don't cross post. This is a Swing related question and you have already posted in the Swing forum:
    http://forum.java.sun.com/thread.jspa?threadID=619619&tstart=0

  • How can I use Siri for IPhone?

    How can I use Siri for IPhone?

    Siri only works on the iPhone 4S or iPhone 5. If you have one of those devices, turn it on in Settings > General > Siri.
    If you need more info than that, ask in the Apple forums.

  • How can I use music for ringtones on my iphone 4?

    How can I use music for ringtones on my iphone 4?

    You can take any MP3 file that it 40 seconds or less and change the file extension to M4R. Then drag it into iTunes. It will appear under Ringtones and transfer over next time you sync,

  • Can I use iCloud for backup?

    Can I use iCloud for backup?

    To back up all your data you are better off getting an external hard drive.  For details on iCould, read: http://www.apple.com/icloud/.

  • I am using MS Office 2010 and Windows XP Professional, can I use iCloud for backup of my files and documents?

    I am using MS Office 2010 and Windows XP Professional, can I use iCloud for backup of my files and documents? I am planning to transition to a Mac so using the iCloud seems to make the most sence.

    No, it is not a backup method at all.  If you delete a sync'd file on any device, you delete it permanently from iCloud.  That by its very essence is not a backup solution therefore.  A backup solution does not automatically and simultaneiously delete the file everywhere when it is deleted from the original source.
    iCloud is strictly a syncronization tool for using files on multiple internet connected devices.

Maybe you are looking for

  • ADF: Gracefully handling JDBC connection errors?

    Hi gang We've a use case to display a specific web page when the JDBC connection drops out on our ADF application, specifically the following error: oracle.jbo.DMLException: JBO-26061: Error while opening JDBC connection. I've been researching soluti

  • Test whether named column exists in a  view

    hi, I need a test, for an if..then else clause to tell me whether there is a column named 'family' in a view. Thanks in advance, Jon

  • Creating Multiple Users in AS Portal using PL/SQL

    Hi Guys, I am very new to Portal and I was wondering if there was a way to add multiple users to Portal using a PL/SQL API? I have found an API called wwsec_api which has a function add_portal_users but this doesnt seem to work when I try to add a us

  • E_ADEPT_INTERNAL error

    Hi, I've download a file .acsm, but when i try to import it on digital edition it tell me that there is the errore e_adept_internal: what shoul i do?

  • Deleting from reading list?

    How do i delete items from my reading list? Thanks fm86