How to define your own context in an EJB environment - possibly distributed

I would like to setup a context (an object accissible per logical thread) in an EJB environment, but I am too unfamiliar with the options I may have.
My objective is to create a context in which I may set a value, then invoke a method on an object (which in turn invokes a method on another object and so forth) and eventually get back the value from the context. In other words I am trying to pass a value without passing it as a parameter. More specifically, I have written a JDBC Driver wrapper in which I want to intercept a number of method calls and based on the context settings perform one or the other JDBC preprocessing. The reason for not passing the values as parameters is to interfere as little as possible with any environment in which this code is to be integrated. I simply want to set the context and get the context (in my JDBC wrapper) without the surrounding code needing to change.
I have succeded partially by using a ThreadLocal object to hold my context. I can set and get the values to and from the context and actually pass values to my Driver wrapper without explicitly passing them as parameters. This works well in a non-EJB environment. My concern arises when I switch to the EJB environment.
If my context is set in a session bean, which invokes an entity bean, am I then guaranteed that these will execute in the same physical thread?
If the session and the entity beans are hosted on seperate machines then the answer would certainly be NO. Is there any way to have the container manage the context and propagate it accross containers when needed?
Any thoughts or suggestions on this topic are wellcome, even if they don't solve the issue entirely.
Looking forward to hear from you all!
/poul

In an EJB environment, you have absolutely no control over threading issues. (It was purposefully designed that way.) However, you do have your own little "sandbox" in the EJB ClassLoader - which is why there is a lot of use of the Singleton pattern for factories and (very carefully!) as small caching mechanisms. You might want to look into that avenue - but you have to know how your EJB vendor's ClassLoader scheme works (there does appear to be a convergence in this area) and you must be very sensitive to potential thread-blocking operations that may take a while to complete.

Similar Messages

  • How to define our own selection screen for logical database  in abap-hr?

    Hi Friends,
    Can u please help me
    How to define your own selection screens for  logical database.
    we use to do like(goto->attributes-HRReportcatagerious ).but How to desin using  customer table like t599c, t599f and how to add to my logical database?
    Thanks in advance
    charan

    check out this online help
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/dba65c35c111d1829f0000e829fbfe/frameset.htm
    Regards
    Raja

  • How to define specify a context-root?

    Hi ,
    I get the error:
    The services configuration includes a channel-definition
    'my-cfamf' that has an endpoint with a context.root token but a
    context root has not been defined. Please specify a context-root
    compiler argument.
    how to define specify a context-root?Thanks
    MK

    Hi Chiru,
    Login to Sysadmin resp and go to
    Security-->Users-->define
    then query your username,in the direct responsiblity tab u can add the GL resp.
    Hope this helps you.
    Cheers,
    Vijay

  • Defining your own type in java...?

    is there anything similar to C's enum in java for defining your own types?
    i.e. id like to make my own boolean type which isnt restricted to just true or false, but rather can be also undefined.
    any help will be appreciated

    That has nothing to due with C's enum construct.
    No there isn't. I think it will be in the next
    version.
    Have a look here how to make one:
    http://developer.java.sun.com/developer/Books/effective
    ava/Chapter5.pdfic, so iz it something like generics?

  • How To Use Your Own Router with Out Loosing Verizon's FIOS Services

    How to use your own router with Verizon’s FIOS Service
    First, you need a basic understanding of how FIOS works but unfortunately there are two types of FIOS systems out there. All of the systems utilize a fiber optic cable to bring TV, phone and internet to your location over one optic cable. In addition these systems provide interactivity including widgets, remote DVR, movies on demand and so forth via an IP (Internet Protocol) signal.  Your STB (Set Tip Box) requires both a video and IP signal. The IP signal is necessary for all of the aforementioned interactivity.  The fiber cable terminates at the Optical Network Terminal or ONT for short.  The ONT converts the optics into a digital signal that can be utilized by ones equipment.  From the ONT your video, phone and internet are provided to the location.  This is where things can differ as the internet signal can be provided via a coaxial (MoCA or Multimedia over Coax Alliance) or RJ45 Cat5 (Ethernet) cable.  It is important to identify and understand the differences of these two setups.  In my case I have my internet entering via Ethernet cable, which in my humble opinion makes things a heck of a lot easier.
    How does one tell the difference? In most cases it’s rather simple; just look at the Verizon’s router WAN (Wide Area Network) Port.  Does it have a RJ45 (Ethernet) or Coax (TV cable Cord) going to it? If the router’s WAN port doesn’t have a coaxial connector then one will need to convert the MoCA signal into a usable Ethernet signal that routers understand. The easiest way is to use Verizon’s router as a bridge. In this method the Verizon’s router simply converts the signal and passes it along to your own router. The challenge is to try to maintain the interactivity that FIOS TV provides. Because of this one needs to supply the IP routed signal back to the FIOS router.  There are multiple methods for doing this and I would recommend investigates which one make the most sense.   
    In my particular case the IP signal was provided by Ethernet.  Again there are various ways of installing one’s own router. The hardest is to utilize Verizon’s router as a bridge.  This setup requires configuring Verizon’s router as a bridge and also creating a VLAN (Virtual Local Area Networks). In addition one needs to set up their own router so it will work with the various routing tables and networks. For me this is too complex for the average person and it can be difficult to trouble shoot if something goes wrong. Please consider that Verizon will not support utilizing third party routers.   
    The easier method is to request an Ethernet signal (if you don’t already have one) from their ONT.  I would highly recommend getting your hands on a NIM or Network Interface Module. This device is used to convert Ethernet to Coaxial so it can be fed back to your STBs.  These can be purchased online and Verizon technicians can be a valuable resource with these sorts of acquisition.  At the very least they can point you to the right direction.  Once you have a NIM the rest is rather simple.
    Log into the current Verizon Router.
    Located the router’s MAC address and copy it down.
    Go to the port forwarding section and copy down the Applied Rules. 
    Example:  
    Network Computer/Device: 192.168.1.100:63145
    Application & Ports Forward:  Application UDP Any -> 6347  
    Note: There may be up to three entries for each one of your Set Top Boxes.
    Look at your current device list, typically found on the home screen. Copy down your STB MAC and IP address.
    Example:
    IP-STB1
    Connection Type: Ethernet
    * IP Address: 192.168.1.100
    IP Address Allocation: DHCP
    *MAC Address:                07:73:fFe:ad:8b:3f
    * Things you will need to write down
    Go to the network section and look for the main Ethernet connection.  Select this and then select more setting, typically found at the bottom. Release the current lease.
    Remove the Verizon router
    Install your router
    Connect the NIM by plugging in an Ethernet from one of the routers LAN (Local Area Network) ports to your NIM. Then connect the coax cable, the same cable that was used by Verizon router.
    Set you DHCP routing IP pool to accommodate Verizon’s STB IP’s  (note their IP’s start at 192.168.1.100)
    Go to DHCP section and reserve the STB IP’s by inserting the IP’s and MAC addresses. This shall ensure that nothing else utilizes the same IPs as the STBs thereby preventing IP address conflict.  
    Add the port forwards from Step 5 above.
    Clone Verizon’s Mac Address utilizing the info from step 2
    Finish setting up the router in typical fashion.
    Unplug and re-plugin your STB’s and test functionality.  It’s best to try using a widget or Movie on demand function.
    Note: if the new router can net get an internet signal contact Verizon’s support and have them release the IP and reset the ONT.  
    EVERYTHING should be working at this point.

     3 Go to the port forwarding section and copy down the Applied Rules. 
    Example:  
    Network Computer/Device: 192.168.1.100:63145
    Application & Ports Forward:  Application UDP Any -> 6347  
    Note: There may be up to three entries for each one of your Set Top Boxes.G
    Your display obviously is not like mine as mine does not dosplay the port associated with the ip address
    whatever, the STB's start at 192.168.1.100 and icement by 1 for each
    the port addr's will be 63145 alo incrementing by 1
    there is 1 entry for each in my pf list
    however each ip addr also has a port entry starting at 35000 also incrementing by 1 for each ip addr
    For some unknow reason these are duplicated e.g I appear to have 11 entries exaactly the same for each stb and as the fios services rules have no action switc there is nowhere to delete the extraneous garbage.
    Why do you clone the mac addr??

  • Style Elements - defining your own ?

    hi,
    I have a list of typography elements to define styles
    for - can map most to 'heading1', 'heading2', 'Portlet
    Header', etc. style elements in the portal style.
    however, to make more meaningful names for our site -
    e.g. 'Content Header', 'copy text' etc - would be
    useful to define our own style elements (while still
    utilising the portal's 'edit style' page - don't want
    to have to resort to our own css style sheets).
    I have used item attributes to force new elements on
    the Item Element Type - and this will work (exposes
    our own defined style elements in the style sheet, and
    allows our own naming system).
    question is - are there any other ways of achieving
    this? has anyone else done something similar?
    also - can we rename 'heading1','heading2' etc to
    our own more meaningful names?
    also - anyone else think it would be useful to be
    able to specify pixels as well as point for font
    size?
    thanks
    kev

    That has nothing to due with C's enum construct.
    No there isn't. I think it will be in the next
    version.
    Have a look here how to make one:
    http://developer.java.sun.com/developer/Books/effective
    ava/Chapter5.pdfic, so iz it something like generics?

  • How do transfer your own DVDs to ipad

    How do you transfer your own DVDs to iPad

    presuming you mean home made dvd's, not commercial dvd's....Handbrake is a great program to convert file types. You then sync those via iTunes to your device.
    If it's commercial dvd's, you're on your own because no one here can help you break the encryption on those.

  • How To Find Your Own Posts Easily

    It’s not very convenient to search for your posts, every time you log into the Forum. So here is how you can effortlessly find your own posts.
    1. Click on your screen name on the right hand side, below My Community. 
    2. This will open your profile page. At the left side, just below your name, the Recent Posts by… list will show latest posts you have created. 
    3. If you don’t see the post you are looking for, click on the View All link just below the list.
    This will list all the posts you have done in the Forum, till date. If there are more than 20 posts, they will be listed on different pages.
    Now that you have found your post, you can show your appreciation to people who helped you, by giving Kudos. To learn how to give Kudos - check this link:
    How To Give A Kudos
    I work for HP, supporting HP experts and trying to help this community as much as I can.

    Change your iTunes (Apple ID) password along with any other password that was stored in the iPod.  If any passwords are associated with credit cards, contact the CC company and get your card replaced (with a new number).  If any passwords are associated with your bank or any savings institution, contact them also and discuss approprate action with them.
    The "Find my..." function is pretty much useless if the device is in the hands of a thief.  All that is necessary is for the thief to connect to any computer with iTunes and "Restore as new."
    The only real protection you have is with the personal information on the device rather than the physical device itself.  This requires action before the device is lost/stolen.  If the device has significant personal information, it should have a strong 8-digit (or longer) password AND be configured for automatic wipe in the event of ten consecutive incorrect password entries.

  • How to create your own theme?

    Is it possible to create your own theme for use with iDVD?
    I know there are some commercially available (e.g. www.ithemez.com), but what tools are needed to create your own?
    Thanks,
    Pete.

    Actually, DVDSP has the ability to do everything that iDVD can do and much much more. The idea is to author your own themes in DVDSP, not use pre-made off the shelf ones... if you want cookie cutter design, go with iDVD. Even with the tutorials below, you are still limited on what you can do... that is a limitation built into the application itself. Perhaps a future version may change all that, but with added flexibility also comes added complexity. Some prefer keeping things simple.
    Here is the complete iDVD 5 tutorial list:
    Part 1: Basic Custom Button Creation
    http://www.creativemac.com/articles/viewarticle.jsp?id=31388
    Part 2: More on Custom Buttons and Highlights
    http://www.creativemac.com/articles/viewarticle.jsp?id=31517
    Part 3: Creating Motion Buttons and Motion Masks
    http://www.creativemac.com/articles/viewarticle.jsp?id=31843
    Part 4: Changing highlight colors on buttons
    http://www.digitalproducer.com/articles/viewarticle.jsp?id=32284
    Part 5: Creating custom drop zones
    http://www.digitalproducer.com/articles/viewarticle.jsp?id=32445

  • How To Build Your Own Audit Rules in Jdeveloper 11.1.2.0.0 ?.

    Hi All,
    I am using Jdeveloper 11.1.2.0.0. I followed below link:
       http://www.oracle.com/technetwork/developer-tools/jdev/index-098707.html#01But in this link ,they are explained about how to creating our own audit rule in Jdeveloper 10g.
    How to create our own audit rule in Jdeveloper 11.1.2.0.0 ?.
    As per my old link,
    Jdeveloper 11.1.2.0.0 Aduit rules problem.unable to add more rules and change that warning message.
    As per the below link,
    Third party extension in Jdeveloper 11.1.2.0.0unable to use any third party (PMD) plugin.
    Any idea ?.
    Thanks Advance.
    Regards,
    Vass Lee

    Hi..
    Check followings
    http://andrejusb.blogspot.com/2010/03/red-samurai-tool-jdeveloper-11g.html
    http://blogs.oracle.com/jdevextensions/entry/don_t_fear_the_audit

  • How to use your own database with your users to authenticate in a Web app?

    Hello, everybody!
    I'm starting to write my first web application and I'm going to use JSF, JPA and EJB3 in this application. One of the first things that I have to do on it is the authentication part where I'll have a page with a user name and a password for the user to login. So, as I'm new to all this in Java (I've already implemented this on .NET in the past), I was studying the Java EE 5 Tutorial, especifically the section "Example: Using Form-Based Authentication with a JSP Page". But I saw that the users that the sample application uses come from the file realm on the Application Server. The users are created there and assigned a name, a password and a group. After the users are in the Application Server we can simply uses forms authentication declaratively in the deployment descriptor (web.xml).
    But the problem is that this doesn't work to me as I already have my own database with my users, so I want to use it instead of having to create the users on the Application Server.
    So, I'm asking you how to do that. Of course I'm not expecting that you place the code here to me as I know that such a thing could be complicated. Instead, I'm asking if you know about some tutorial, article, book or something that teaches how to do what I want. But I would like to see theses examples using JSF and/or EJB3 because these are the technologies that I'm using to develop. It's a pity that the Java EE 5 Tutorial doesn't have an example using a custom database as I know that this situation is very common in the majority of web sites.
    Thank you very much.
    Marcos

    From memory, it goes like this... You just create a
    raw jdbc connection on your user database using a
    special "login" DB user account, which has
    permissions only to an "authenticate" stored query,
    which accepts two arguments: username & password, and
    returns a boolean 0 or 1 rows found.When I implemented this in .NET's ASP.NET I had the same solution. I had an special user created in the database that I used to log in. When the real user entered his username and password I was already logged in and I had just to check his username and password agains the right table in my database.
    But that was only possible bacause when I connected to the database using my hidden user, I used the rights APIs in ASP.NET that coordinate the authentication process. This means that before login in, no one could access any resources (pages, atc...). So what I'm saying is that I can't manager this manually in Java. Java has to have some API or whatever to allow me to control the login process programmatically, while letting the Application Server control the access to the resources.

  • Here's how to use your own custom Webclip icons for the sites you visit.

    This method is pretty much 95% taken from this URL: http://allinthehead.com/retro/319/how-to-set-an-apple-touch-icon-for-any-site , so credit where credit is due. The instructions are a bit hard to understand though, so I'll try to make it easier for everyone.
    Fortunately, this works for both Macs and PCs.
    INSTRUCTIONS:
    Requirements:
    - iPhone on 1.1.3 and any version of iTunes that can sync to iPhone
    - Adobe Photoshop or any other image editing program that can crop, alter image size, and save .png image files. (Recommended 24-bit .pngs as they are higher quality)
    - Apple Safari ( http://www.apple.com/safari/, and yes, you need it.)
    - A website or ftp where you can upload images and directly link to them, like Google Pages.
    Warning:
    - This requires you to sync your Safari bookmarks to your iPhone. You will probably lose all of your iPhone's bookmarks if you don't already sync your Safari bookmarks with your iPhone. Only proceed if you do not mind losing your iPhone's current bookmarks and do not mind re-entering them after the bookmark sync. NOTE: The bookmark sync DOES NOT get rid of your current Webclips though, so don't worry about those.
    Easy Steps:
    1) First, make sure that you are following these instructions in the Apple Safari web browser.
    2) Find an image you wish to make into a Webclip icon. (ex: I prefer to use movies.yahoo.com to look at movie showtimes, so I found an image of a movie reel from Google Image Search and decided to use that.)
    3) Open the image with your preferred image editor and crop your desired image into a perfect square. Resize that picture down to 57x57 pixels. Save as a 24-bit .png file. Upload the icon to your webpage or ftp. (ex: I ended up with this icon of a movie reel: http://ctolpin.googlepages.com/appleicon01.png )
    4) Select and copy the javascript code in this .txt file: http://ctolpin.googlepages.com/webclipcode.txt
    5) Go to Bookmarks and select "Add Bookmark..."
    6) Type in "Webclip Icon URL"
    7) Go to Bookmarks again and select "Show all Bookmarks."
    8) Right-click your new "Webclip Icon URL" bookmark and select "Edit Address"
    9) Paste your clipboard's contents into the field.
    10) Plug your iPhone into the computer if it's not connected already.
    11) In iTunes, select your iPhone from the right column. Select the Info tab. Scroll down to "Web Browser" and check "Sync bookmarks with: Safari" (obviously, make sure Safari is selected from the dropdown menu).
    12) Once your iPhone is synced, use your iPhone to navigate to your intended website target to make into a Webclip. Remember that Webclips save where you zoom in as well! (ex: For me, it was movies.yahoo.com and then entering in my zip code.)
    13) Once you've loaded your target website, open up the bookmarks in iPhone's Safari, select Bookmarks Bar, then select Webclip Icon URL.
    14) Type in the address of your uploaded icon. (ex: In my case, it is http://ctolpin.googlepages.com/appleicon01.png)
    15) iPhone's Safari will seem like it didn't do anything. However, add that webpage now to your home screen as a Webclip. Magic.
    Additional note:
    It is easiest to make a bunch of icons at first and to upload them. However, once that "Webclip Icon URL" bookmark is in your iPhone, there is no need to go back and do any of the computer Safari steps again
    My front page icons in order (Sorry Stocks, it's the second page for you!):
    Google, Wikipedia, Definr, Showtimes
    http://ctolpin.googlepages.com/iphonecampics007.jpg
    Message was edited by: LumpOfCole

     3 Go to the port forwarding section and copy down the Applied Rules. 
    Example:  
    Network Computer/Device: 192.168.1.100:63145
    Application & Ports Forward:  Application UDP Any -> 6347  
    Note: There may be up to three entries for each one of your Set Top Boxes.G
    Your display obviously is not like mine as mine does not dosplay the port associated with the ip address
    whatever, the STB's start at 192.168.1.100 and icement by 1 for each
    the port addr's will be 63145 alo incrementing by 1
    there is 1 entry for each in my pf list
    however each ip addr also has a port entry starting at 35000 also incrementing by 1 for each ip addr
    For some unknow reason these are duplicated e.g I appear to have 11 entries exaactly the same for each stb and as the fios services rules have no action switc there is nowhere to delete the extraneous garbage.
    Why do you clone the mac addr??

  • How to build your own install img?

    How do I build my own arch install image...iirc there are tools but I don't know how to use them.
    Also is it possible to use the usb .img installer off of one's harddrive?  I know I can use dd to put it on a partition, but was wondering if it would be able to boot and install properly.

    This is from an email by Dieter to the arch-releng list:
    git clone http://projects.archlinux.org/git/archiso.git
    cd archiso/archiso
    sudo make install #to be packaged later
    cd ../configs/install-iso
    # change version in Makefile
    # if on x86_64, remove intel-536ep and intel-537 from packages.list
    ./buildall.sh
    scp release/* ...somewhere...

  • How to add your own videos or photos?

    I want to know how to add Photos and Videos from my PC to my iPod...

    Well, there are a few ways. I'll tell ya two. First is iCloud. If you don't already, you can create an Apple ID and set up iCloud. To set up iCloud on PC, visit this site. Everything should sync after that.
    You can also use iTunes to sync up everything. First, put the photos that you wanna put on your iPod on to iPhoto. Put the videos you wanna put on iTunes. Like, drag the video into the "Videos" tab on iTunes. Then, go to the the iPod in "Devices" connected to iTunes. Once you select the phots and videos, press Apply/Sync.
    You're done.

  • ALV GRID Edit Validations (how to do your own)

    Hi folks, I am using ALV Grid to enter some data, I would like to do some validations on save and also adjust data in the table and validate it upon another few buttons.
    All is good and works fine using the standard events, however these events are only triggered if you directly change the data yourself, <b>I need validates once a button is hit</b>.
    I have been playing with the following methods, and the cells are returned in the "good" list and the mod list (as expected), but the cell on the screen is not highlighted in red, and if you change something on the screen, the messages you have added are then lost.
      CALL METHOD p_grid->change_data_from_inside
        EXPORTING
          it_style_cells = lt_modi.
    Has anyone added there own custom validations upon hitting a button - in a manner that the red cell border is shown?
    I have tried both of these handlers:
    CALL METHOD p_defn-grid->register_edit_event
       EXPORTING
         i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    **Own event on enter or ucomm
      CALL METHOD p_defn-grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    I am adding in my messages in event data_changed, using method add_protocol_entry of class cl_alv_changed_data_protocol - this is passed to me in the data_changed event.
    I have also looked at the data_changed_finished event, but cant get anything from that either - it doesn’t even keep my good fields.
    Ps I have also played with the layout setting layout-val_data = 'X' and space and "C" - but the messages are still not kept, and cells not bordered in red.
    The solution may have something to do with triggering the event manually somehow - but i cant find a way to call a method that would do it as they are all private!
    thanks in advance - this is a tricky one!

    Adobe Pat 206
    You cannot create a Premiere Elements (any version) DVD Template from scratch using Photoshop Elements (any version). To do that you need Photoshop CS or higher. The reason for "higher" is that earlier Photoshop versions do not support Layers Groups within the Layer Groups.
    But, providing you find a version of Photoshop Elements on a given computer operating system that will open the Photoshop Layer Groups in its key structure (.psd file), you can use Photoshop Elements to edit (not create from scratch) the .psd file for the main and scene menus of a given existing Adobe theme. I am careful on my language here since there have been recent difficulties getting Photoshop Elements to do this job which it once did without issue.
    The process is easy enough, but very detail dependant, with strict requirements for names files as well as Layer Groups, sublayers groups, and layers in the .psd file. To give you an idea of what is involved, please check out two articles I have written related to Premiere Elements DVD Template creation and customization.
    http://www.elementsvillage.com/forums/showthread.php?t=56244
    http://www.atr935.blogspot.com/2013/05/pe-one-page-14-scene-buttons-dvd-menu.html
    Not placing the new menu in the correct directory and any error in spelling and such are just some of the ingredients for failure in this type of project.
    Unless you want to add extra buttons to a menu, it might be easier for you to explore customization opportunties in the Movie Menu section of the program. See Tools/Movie Menus. The Movie Menus customization area should look like this
    Note that the Adjustments...Menu Background shows Video or Stills among other things.
    If you have questions on anything that I have written, please ask me here in your thread.
    You can also check out the Adobe documentation on this type of topic.
    http://help.adobe.com/en_US/premiereelements/using/WS09e4b3c48f3a79fc19b622510385d4355c-7e 0c.html
    Thanks.
    ATR

Maybe you are looking for