Can l make an instance of EJB home handler / Datasource shared by EJB objs

all ejb guru
As far as l know, it is general rule of thumb to cache the EJB home handlers and datasource object at EJB bean instance. But can l go a step further, make the same instance of EJB home handlers and datasource object shared by more than 1 EJB bean instance ?
( l checked out the methods of javax.ejb.EJBhome and javax.sql.DataSource. They are not declared as synchronized. It seems to me that EJB home handlers and datasource object are not thread safe and not suitable for being shared. Even they are thread-safe, if they are shared by 1+ EJB bean instance. Sharing EJB home handlers and datasource object may interfere the thread management of EJB container. Am l correct ? )
It is highly appreciated someone can share with me your insight in this issue.
thanks & regards
Danny

Okay, you got me there. However, it's usually a better practice to start a new thread with your specific question instead of resurrecting old threads that (obviously) nobody cared enough to answer.
DataSources are retrieved from the container via JNDI. You may (generally) cache them in order to alleviate the JNDI lookup without worrying about Threads, as there is only (usually) one DataSource object per server (or node in a cluster). Do not cache (in your code) the Connection objects obtained from the DataSource - always close them in order to return them to the pool maintained by the DataSource.
Caching EJB HomeHandles is the accepted manner of avoiding repeated JNDI calls to locate EJBs. Typically, extracting the EJBHome from the HomeHandle re-initializes whatever network operations are embedded in the EJBHome object(s) by the vendor's implementation. Once again, you do not necessarily need to worry about Threads - the container and vendor implementation is already taking care of that for you, transparently.
Think about it: if there were Threading issues, even retrieving the above objects via JNDI would ensure that J2EE application servers wouldn't be Thread safe and all operations would be, essentially, blocked each time. Obviously, this is not the case since both DataSources and EJBHome objects can have multiple clients using them simultaneously. Just because there's not explicit synchronized tag on any of the methods defined in these interfaces doesn't mean they're single-Thread objects.

Similar Messages

  • How can I make one computer server at Home for access of SQL Server 2012/2008

    Hi All,
    Sorry for this basic question but I am zero in networking. I will be very grateful if someone guides what should I do to make one of my home PC as server. Scenario is as follows:
    I want to give training to few students about SQL SERVER T-SQL.
    I have one Laptop using SQL Server 2012 having Windows 7 Pro(Laptop Master-want to make this server). I have other laptop running Windows 7 pro and got SQL SERVER 2008. My students have mix of laptops including Windows XP, Windows Vista, Windows 7 and Windows
    8. All students have SQL SERVER 2008 installed and working.
    Q1: I actually want to make Laptop Master(explained in above paragraph) as server and want other laptops to access that master server in home network. I will install sample exercise database on server and students will be writing queries to access
    data.
    Q2: can I secure sample database from students who can copy sample database from server?
    Q3: can students run queries remotely sitting their home?
    Thanks in advance.
    Kind Regards
    A K
    Adnan

    Hi itsadnan,
    According to your description, if you want to make your Laptop as Server, and your student can log in your SQL Server 2012 instance, you need to ensure that your computer and student’s computers are the same domain, and you enable TCP/IP, name pipes protocol
    in SQL Server Configuration Manager, your SQL Server 2012 instance is allowed to connect remotely and your student install SQL Server Manager Studio 2012 as client tool in their computer, and you create the related login name for your students. For more information,
    see:
    http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
    According to your requirement, in actual, since your students install SQL Server 2008 on their computer, you totally can ask your student to install the sample exercise database in their SQL Server. For example, there are many resource about sample database
    in Website, which is helpful for student to learn database technology, such as
    AdventureWorks databases for SQL Server 2008. From SQL Server Management Studio, they can attach an AdventureWorks database, then write queries to access data.
    Since you have SQL Server 2008 in your other laptop, you can create the sample exercise database, and student can install this database via backup and restore, then write queries to access data and send to you for checking if it is right.
    Note:  Due to backwards compatibility, The students could not restore SQL Server 2012 database in their SQL Server 2008 instance.
    Thanks,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Can i make my email page my home page

    I WANT TO MAKE MY EMAIL PAGE MY HOME PAGE CAN THAT BE DONE?''bold text'''

    Most webmail sites require you to login which makes what you want to do difficult. However, you can try doing this.<br><br>
    #Go to your webmail and login.<br><br>
    #Right click the tab and choose "Pin as app tab". The tab will shrink to a smaller size.<br><br>
    #Right click the orange Firefox button, go to Options | Options | General.<br><br>
    #Make sure it says "Show My Home Page" at the top.<br><br>
    #Click the button called "Use Current Pages" to set your home page to the one you have on the screen.<br><br>
    #Close Firefox and restart it again to test.<br><br>
    N.B. Make sure you don't have "Clear history when Firefox closes" checkmarked in Options | Options | Privacy.

  • How can I make the Instance name the same as the name of the Movie clip in an animation.

    Hi, I am an animator for a small game project and I have this really big problem. Even though I used flash for animation for a long time I am a newbie when it comes to something technical. I just received a request to make every movie clip that I use  to have a consistent <Instance name> in every frame of the animation. Only if they told me this earlier... Is there an easier way to make the <Instance name> the same as the name of the Movie clip used other than manually entering it. I have 16 characters with 12 body parts with 20 animations each with about 6-7 frames for each body part it will take me months and nightmares evey night to enter everything by hand. Please help me keep my sanity!
    I'm not sure if I explain correctly, so here is a picture:
    Thank you!

    Thank you for the fast answer! I found this video on jsfl functionality that deals with a similar problem, I am not a coder so it will take me some time to figure it out, but when I do I will probably post the answer here. Here is the video:

  • Droid X can't make/receive calls/texts from home

    I've been experiencing problems with my phone for about 2 days now. I can't use it to make calls or texts and I don't get any from anyone either. If I literally drive 2 miles down the road, the phone works. I've tried to reset it using *228 and update the roaming settings. I've taken the battery out while the phone is on, and even manually powered it down, but nothing works. The phone shows I have full signal strength until I actually make a call, then the bars disappear and the call never connects. The same thing happens when I try to send a text; it just never sends. I can connect to the internet, so there's no problems there. I appreciate any help.

    Hello chinesesnowplow
    Wow! That's very upsetting not being able to call or text from your home. Let's get to the bottom of this immediately.
    Are you still experiencing the issue? Are there any other devices having this same problem in your home? Did this start after a particular application was downloaded? Please place the device in airplane mode. Go to Menu> Settings> Wireless & network settings> then check mark airplane mode until the signal changes. Then uncheck airplane mode and retest.
    Please let me know if this helps, if not I would be glad to further troubleshoot with you.
    Thank you
    JoeL_VZW
    Please follow us on twitter @vzwsupport

  • How can I make parallel Instances of a VI, avalible through webserver URL?

    Hello, I have a vi that I want multiple people be be able to access at the same time through the web.  Each time a client accesses the URL I want the VI to start a new instance in paralles for them.  So if 5 people went to the URL each would be using their own independent parrallel instance.  I dont want them to be able to see what the other is doing.  Kind of like if you start solitare then click its .exe again it starts another seperate instance of it.  I tried using reentrant execution still showed to the second client that the .vi is controled by someone else, even attempted making it a sub-vi called by a main but i would have to make the main one the .html and it wont display the sub vi's in the webpages embeded window.  
    Any Ideas?
    Thanks In Advance
    I'm running :
    Windows XP Pro. SP3
    LabView 8.0

    I did this once using CGI in combination with a VIT. the CGI server would open this VIT and create the dynamic web page to show this VIT to the user by using remote panels. So each user had its own anstance of an remote panel.
    To explain it in details:
    the index.htm would have a POST command in it that will trigger when the user opens up the web page. This post command informs the CGI server. The cgi server then creates a VIT in memory, and creates a dynamic html code that is sent back to the user, (this code would be the html code for a remote panel) but where the VI name that is shown in the remote panel will be the same as the new name that the new VIT got in memory.
    Remember also to shut down the VIT when the user closes its browser, otherwise you'll going to have a lot of VIs in memory after a while!
     If any questions just ask, you could actually also use datasocket to retrieve the post command.
    On tip: the CGI part of labview runs in an own instance. You must link the VIT you your main application instance for it to be able to communicate and share data with your main apllication by using VI server. (weird sentence..)

  • When I open a new tab, I can't make it go straight to home page.

    If I open a new blank tab, I want it to go to my home page, as I want to search for something else. But I have then to click on the Home tab, which on a wide screen , is a mile to the right. I would like to be able to make a click on the new tab cross take me straight to my home page. I think I uised to be able to do this in older versions (running 4.0.1)

    Use this add-on [https://addons.mozilla.org/en-US/firefox/addon/custom-new-tab/ '''Custom new tab'''].

  • I can only make outgoing calls. My home button is only working for voice control and won't take me back to menu. I am only in the calling screen and can't even shut off. What do I do?

    I am freaking out! I am a college student and owner of my Iphone 3Gs. I just got it this past August and I don't understand what is wrong. I did not drop it or come into contact with any water or disabling substance. I am literally stuck on the calling page with favorites, recents, contacts, keypad and voicemail. When I push my Home button I am not brought back to my menu. When I hold it down voice control is enabled but I still can't get to my menu. Then when I try to hold the sleep button to shut off nothing happens. What's wrong with my phone? I can't even go into contacts and hit text message nothing happens. Also, when I get a message in nothing happens when I push view. Please help me.

    Try a reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider. Takes about 5-15 secs of button holding and you won't lose any data or settings.

  • Sharing photos from iphoto 11, why does the photo information not upload when I click with share via email?  How can I make sure the photo information and location are shared when the photo (s) are shared.

    When I go to share photos in iPhoto 11, The photos transfer to the email I'm sending but the photo information and location don't.  The older version of iPhoto did it, why not this version?  What am I missing in the process of sharing via email?, Thank You.

    When you share to email do you get the following dialogue:

  • Can't create an alias for User home folder for a second user

    Please help:
    I can't make an alias of a User home folder of a second user. I can successfully make an alias of a home folder of the first user. The computer says the folder is in use and to wait for some activity to complete, or that I don't have enough privileges. There are no activities happening and both accounts are administrator level. Is this a behavior of OS 10.5.6? I created alias for the two users before, but had unrelated problems and wiped the drive, re-installed 10.5.6 and now I can't do it.
    Much thanks and aloha - Rocky

    hi Petar,
    Wish it was that simple where i can just change the ID to ACT but unfortunately alot of our users like to hardcode there currentview and changing the scenario dimensions would take a big effort and alot of support work.  We had changed one of the dimension members before and we got phone calls asking why the report doesn't work for weeks.  Do you know if the NW version of BPC has that capability?
    Thanks,
    Elmer

  • ClassNotFound while narrowing JNDI ref to ejb home interface

    Hello everybody
    I'm quite new to BEA WebLogic. I deployed Jasmine application on Bea WLS7 (example
    app from Mastering EJB 2). But when i tried to use login servlet, it threw an
    exception ClassNotFound when narrowing ejb home interface (obtained via JNDI).
    EJBs are in .jar file, and web files are in the .war file, maybe this is the problem.
    Should I copy ejb classes to .war file, or make some tricks with CLASSPATH, or
    maybe there is better way to make it work (maybe via J2EE references or something
    like this).
    Thanks in advance

    Strange. And you do not have any application classes in the system
    classpath?
    Konrad R. <[email protected]> wrote:
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Did you deploy ejbs and war in the same ear?
    Yes, both were packed up into one .ear archive>>
    Konrad R. <[email protected]> wrote:
    Hello everybody
    I'm quite new to BEA WebLogic. I deployed Jasmine application on BeaWLS7 (example
    app from Mastering EJB 2). But when i tried to use login servlet, itthrew an
    exception ClassNotFound when narrowing ejb home interface (obtainedvia JNDI).
    EJBs are in .jar file, and web files are in the .war file, maybe thisis the problem.
    Should I copy ejb classes to .war file, or make some tricks with CLASSPATH,or
    maybe there is better way to make it work (maybe via J2EE referencesor something
    like this).
    Thanks in advance--
    Dimitri

  • HT201401 can i make calls while the phone is locked???

    can i make a call while the home screen is locked?

    And that is only if you set it up for Siri to work under the lock screen. In Settings, if you have a Passcode lock on and have Siri turned off for use when the phone is locked, you cannot use it. Just an observation.

  • When not using EJBs can I make BD a Singleton and cache facade instances?

    Hi,
    In an application which does not use EJBs can I make BD(Business Delegate) a singleton?
    I was very sure about doing this but when I tried Google on the same subject the answers were'nt supportive of this but that was in the context of applications which used EJBs. And also item 4 in Effective Java isnt very supportive of caching Objects at the drop of a hat.
    When not using EJBs would it be an unnecessary thing to make BD a singleton and cahce Facade instances in a BD and DAO instances in a Facade? I am planning to use a array based blocking bounded buffer for the purposes of caching. Or would it be better to make both BD and a facade as SIngletons and just cache DAOs in a Facade?
    Any suggestion would be of good help to me.
    Thanks a lot.

    Not sure I understand all your design, but you seem
    to describe an architecture where requests are queued
    and handled serially.Sorry if I messed up while explaining it. No, it will not be handled serially. Since the BD is a singleton multiple threads can pass messages to it simulteanously, a bit like an object of the Action class in Struts. Since I dont see having any synchronized methods in a BD requests will be handled simulteanously.
    The impact on throughput of handling requests
    serially (as opposed to parallelizing them) probably
    outweights by far the cost of instantiating one more
    object per request...Yes, I understand that but as I explained above the reqests wont be handled serially.
    To be more clear, I am thinking of using any one of these two things:
    1) BD(Singleton)-->Facade(Singleton, caches DAOs in a thread safe data structure)
    2)1) BD(Singleton, caches Facade instances in a thread safe data structure)-->Facade(caches DAOs in a thread safe data structure).
    the thread safe data structure I am planning to have is a array based bounded buffer which blocks using wait and notify mechanism.
    Thank you for the reply.

  • Can not find javax.ejb.CreateException when lookup and create EJB instance.

    Hi,
        I installed SAP CE 7.2 and NWDS 7.2. When i call create() of EJB's home interface from JAVA stand alone app to create EJB instance, the complier state that it need  'javax.ejb.CreateException'. How can i find the jar that contain 'javax.ejb.CreateException' to solve this problem?
    Thank a lot,
    Thongie
    Edited by: Thongie on Jul 8, 2011 7:30 PM

    Thank a lot, I can found EJB20.jar at 'usr\sap\<sid>\<instance_id>\j2ee\j2eeclient\'

  • How can I make a intro page for my website, then after the intro has run make the page automatically change to my we site home screen

    how can I make a intro page for my website, then after the intro has run make the page automatically change to my website's home screen

    You can do this using a meta refresh but the problem is you have to add it to the html file for the page very time you publish changes.
    A better way is to create a splash page and upload it to the server outside of the folder produced by iWeb. Example HERE.
    The meta refresh is added to the head section of the html file...
    <meta http-equiv="refresh" content="32;url=http://www.domain.about.com/Page-Name.html">
    The delay time in seconds is marked in blue and the URL to the redirect page is in red.

Maybe you are looking for

  • IPod/iTunes causes Vista to crash

    Plugging my iPod in causes my OS to crash. I really want to listen to my iPod, something I haven't been able to do since I bought this new laptop a few weeks ago. Since Apple doesn't seem willing to support Vista in a timely manner, I wonder if there

  • Text Link Styles not working in Footer Section

    I have a master page with a footer that has three columns of navigation text links inside. In order to match my design I have created a customer text link style for these links. However when I preview my site (in muse and browsers) the roll over effe

  • How to turnoff firewall on solaris 10?

    hey everybody, do you know how to turn off the firewall on solaris 10 ?, because i installed 3 rd party program, and need to disable the firewall... thank you so much, for your help

  • To Develop a Browser using Java

    Hi, I want to know if it is possible to write a browser using java.If so where can i get more information regarding this. Juz let me know the details. Thanks in advance... ramya

  • Indicator-ubuntuone (my first PKGBUILD, I need review)

    Hi, I've made a PKGBUILD of indicator-ubuntuone. I've used City-busz's indicator-sync as a model, but honestly I'm not sure of what I'm doing. It's my first build, I'll appreciate suggestions, corrections,... before uploading it to AUR. PKGBUILD # Ma