Interpretation of the use of threads with Sessions in the JMS Specification

Hello,
I’ve been interacting with two JMS Providers which do a different interpretation of the JMS Specification with the use of different threads for accessing to a session and session’s related objects.
The question is:
When a client is consuming messages asynchronously, is it possible to access session’s related objects from a thread different to the one dedicated to the asynchronous consumption, on (thread of control)?
-     Never?
-     Yes, but the client should provide explicit synchronization.?
Our execution scenario is:
1.- Messages are consumed asynchronously from a dedicated thread.
2.- From other thread, messages consumed are acknowledged.
In the JMS specification there is, at least, two parts where this issue is treated:
1.- The first one (4.4.1 - page 60):
+“There are no restrictions on the number of threads that can use a Session object or those it creates. The restriction is that the resources of a Session should not be used concurrently by multiple threads. It is up to the user to insure that this concurrency restriction is met. The simplest way to do this is to use one thread. In the case of asynchronous delivery, use one thread for setup in stopped mode and then start asynchronous delivery. In more complex cases the user must provide explicit synchronization.”+
This extract, makes me think that it is possible the access from different threads, but If I do that, I should provide explicit synchronization.
2.- The second one (4.4.6 – page 62,63)
+"Once a connection has been started, any session with a registered message listener(s) is dedicated to the thread of control that delivers messages to it. It is erroneous for client code to use this session or any of its constituent objects from another thread of control. The only exception to this is the use of the session or connection close method"?+
This extract, could be interpreted as that the concurrent access is never allowed in the described situation.

I think the key words are in 4.4.6 (and also the javadoc for Session): "Once a connection has been started, any session with a registered message listener(s) is dedicated to the thread of control that delivers messages to it".
My interpretation of this is that you when you register a message listener and call connection.start(), the thread which delivers messages to the listener should be thought of as "using the resources of the session" (as mentioned in 4.4.1) continuously until the connection is stopped (or until the session or connection is closed). it doesn't matter whether the session is executing onMessage() or not.
Given this, both 4.4.1 and 4.4.6 say the same thing: that once you have registered and started a message listener, the only thing you can do to the session from another thread is to close it.
I agree the spec could be clearer. In particular the words "In more complex cases the user must provide explicit synchronization" in 4.4.6 should be clarified to state what this actually means rather than give a hint.
Please note that work has just started on updating the JMS specification, so now is a great time to report areas of the JMS spec which would benefit from clarification. If you'd like this to be considered for clarification, please report it in the official JSR 343 issue tracker at http://jms-spec.java.net
Nigel

Similar Messages

  • HT3986 when i use windows 7 with macbook pro ,the fan work hardly,how do i fix it?

    when i use windows 7 with macbook pro ,the fan work hardly,how do i fix it?

    Use InputRemapper
    This is one or only utility I know, there are I am sure one or two others.
    And the weakest link in running Windows on Mac: lack of thermal/SMC fan control to manage air flow and heat!

  • Hi, i am wondering if i use 4g together with wifi in the same time will this increase the internet speed ?

    Hi, i am wondering if i use 4g together with wifi in the same time will this increase the internet speed ?

    The iPad has a micro-SIM card slot - nothing special or unique about it.
    The iPad is not sold as carrier locked.

  • AirPort Express wireless connection, when I surf the news sites so I linked to **** pages. And must close the window. If I use my iPhone with Internet sharing the same computer, then I have no problem. I believe that it is in AirPort Express, and wou

    AirPort Express wireless connection, when I surf the news sites so I linked to **** pages. And must close the window. If I use my iPhone with Internet sharing the same computer, then I have no problem.
    I believe that it is in AirPort Express, and would have to clean it. How do you do that?

    You need to use the Express in router mode.. I think you are trying to use it in bridge mode.. but you need to give us a lot more details.. screenshots might help more than anything.

  • HT201335 when using apple tv with my ipad, the mirroring function does not work, screen goes black, what is the issue?

    when using apple tv with my ipad, the mirroring function does not work, screen goes black, what is the issue?  My son's Ipad(same as kind as mine) works ok with the apple tv but mine does not.  Any suggestions?

    Hello Nina Izurin,
    While written for the iPhone, the troubleshooting below can help resolve issues with your iPad's camera, as well.
    Camera isn't functioning or has undesired image quality
    If the screen shows a closed lens or black image, force quit the Camera app.
    If you do not see the Camera app on the Home screen, try searching for it in Spotlight. If the camera does not show up in the search, check to make sure that Restrictions are not turned on by tappingSettings > General > Restrictions.
    Ensure the camera lens is clean and free from any obstructions. Use a microfiber polishing cloth to clean the lens.
    Cases can interfere with the camera and the flash. Try gently cleaning the lens with a clean dry cloth or removing the case if you see image or color-quality issues with photos.
    Try turning iPhone off and then back on.
    Tap to focus the camera on the subject. The image may pulse or briefly go in and out of focus as it adjusts.
    Try to remain steady while focusing:
    Still images: Remain steady while taking the picture. If you move too far in any direction, the camera automatically refocuses to the center.
    Note: If you take a picture with iPhone turned sideways, it is automatically saved in landscape orientation.
    Video: Adjust focus before you begin recording. You can also tap to readjust focus while recording. Exiting the Camera application while recording will stop recording and will save the video to the Camera Roll.
    Note: Video-recording features are not available on original iPhone or iPhone 3G.
    If your iPhone has a front and rear camera, try switching between them to verify if the issue persists on both.
    My issue is still not resolved. What do I do next?
    Contact Apple Support.
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/TS2802
    Cheers,
    Allen

  • How to synchronize  the mail  automatically. With out clicking the mail icon ?

    How to synchronize  the mail  automatically. With out clicking the mail icon ?

    You can do that with the keyboard.
    *<b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)
    *http://kb.mozillazine.org/Zoom_text_of_web_pages
    There may be an extension that has a reset zoom button.
    *https://addons.mozilla.org/en-US/firefox/search/?q=zoom
    You can also create your own button and use this code to reset the zoom: <b>FullZoom.reset();</b>
    *Custom Buttons: https://addons.mozilla.org/firefox/addon/custom-buttons/

  • Will the use of an Airport Express widen the range of my existing wifi?

    Will the use of an Airport Express widen the range of my existing wifi?

    Yes, but only if your existing WiFi is being produced by another Apple wireless router.
    The AirPort Express is almost certainly not compatible if you are planning to connect using wireless only with another brand of wireless router.

  • Approach when the used Live cache data area crosses the threshold

    Hi,
    Could any of you please let me know the detailed approach when the used Live cache data area crosses the threshold in APO system?
    The approach I have as of now is :
    1) When it is identified that data cache usage is nearly 100%, check for hit rate for OMS data in data cache in LC10 .Because generally hit rate for OMS data in data cache should be atleaset 99.8% and Data Cache usage should be well below 100%.
    2) To monitor unsuccessful accesses to data cache choose refresh and compare value now and before unsuccessful accesses result in physical disk I/O and should generally be avoided.
    3) The number of OMS data pages (OMS Data) should be much higher than the number of OMS history pages (History/Undo).A ratio of 4:1 is desirable. If OMS history has nearly the same size as OMS data, use Problem AnalysisPerformanceOMS versions to find out if named consistent views (Versions) are open for a long time. Maximum age should be 8hrs.
    4)If consumption of OMS heap and data cache is large, one reason may be a long running transaction simulation that accumulates heap memory and prevents the garbage collector from releasing old object images.
    5) To display existing transactional simulations in LC10,use Problem AnalysisPerformanceOMS versions and SM04 to find out user of corresponding transaction and may be required to cancel the session after contacting user if the version open for long time..
    Please help me by providing additional information on the issue.
    Thanks,
    Varada Reddy.

    Hi Mayank, sorry, one basic question - are you using some selection criteria during extraction? If yes, then try extraction without the selection criteria.
    If you maintain selection based on, let's say, material, you need to use the right number of zeros as prefix (based on how you have defined the characteristic for material) otherwise no records would be selected.
    Is this relevant in your case?
    One more option is to try to repair teh datasource. In the planning area, go to extraction tools, select the datasource, and then choose the option of repair datasource.
    If you need more info, pls let me know.
    - Pawan

  • Date when the cube was filled with data for the last time

    Hi!
    We are using a SAP BW System and on top of it BOBJ for reporting. Within BEx Web Application Designer, it's very simple to access the data, when the cube was filled with data for the last time. Is it possible to access this information within BOBJ, too?
    Thanks for your help!
    Greetings
    Stefan

    Hallo Ingo,
    thanks for your answer. That was exactly what we were looking for.
    We will have to think about a workaround now.
    Greetings
    Stefan

  • Detailed approach when the used Live cache data area crosses the threshold

    Hi,
    Could any of you please let me know the detailed approach when the used Live cache data area crosses the threshold in APO system?
    The approach I have as of now is :
    1) When it is identified that data cache usage is nearly 100%, check for hit rate for OMS data in data cache in LC10 .Because generally hit rate for OMS data in data cache should be atleaset 99.8% and Data Cache usage should be well below 100%.
    2) To monitor unsuccessful accesses to data cache choose refresh and compare value now and before unsuccessful accesses result in physical disk I/O and should generally be avoided.
    3) The number of OMS data pages (OMS Data) should be much higher than the number of OMS history pages (History/Undo).A ratio of 4:1 is desirable. If OMS history has nearly the same size as OMS data, use Problem AnalysisPerformanceOMS versions to find out if named consistent views (Versions) are open for a long time. Maximum age should be 8hrs.
    4)If consumption of OMS heap and data cache is large, one reason may be a long running transaction simulation that accumulates heap memory and prevents the garbage collector from releasing old object images.
    5) To display existing transactional simulations in LC10,use Problem AnalysisPerformanceOMS versions and SM04 to find out user of corresponding transaction and may be required to cancel the session after contacting user if the version open for long time..
    Please help me by providing additional information on the issue.
    Thanks,
    Varada Reddy.

    Hi Mayank, sorry, one basic question - are you using some selection criteria during extraction? If yes, then try extraction without the selection criteria.
    If you maintain selection based on, let's say, material, you need to use the right number of zeros as prefix (based on how you have defined the characteristic for material) otherwise no records would be selected.
    Is this relevant in your case?
    One more option is to try to repair teh datasource. In the planning area, go to extraction tools, select the datasource, and then choose the option of repair datasource.
    If you need more info, pls let me know.
    - Pawan

  • When I delete com.apple.audio.SystemSettings.plist my audio/sound problems are solved. However when the file is replaced with another file, the sound is crappy and the quality is reduced. Can you please help me?

    When I delete com.apple.audio.SystemSettings.plist my audio/sound problems are solved. However when the file is replaced with another file, the sound is crappy and the quality is reduced. Can anyone please help me?
    Sincerely,
    Eric

    Run this when you have the problem and post the results here.
    EtreCheck
    This will tell us what is loaded

  • What is the use of AET? What are the differences between AET and EEWB?

    Hi,
    I would like to know about AET? What is the use of AET? What are the differences between AET and EEWB? Please help me out?
    Thanks,
    Satish

    Hi
    You can refer the following links for your question.
    Difference between AET and EEWB
    What is the use of AET? What are the differences between AET and EEWB?
    Difference between EEWB - UI Configuration Tool - AET
    http://senthilsapcrm.wordpress.com/2010/02/04/adding-custom-fields-in-sap-crm-7-0-using-aet/
    What is the main difference between eewb and aet tool ?
    Hope it is useful.
    Thanks and regards
    Preeti Viswanath

  • Is there a fix yet for the no sound problem with lion on the iMac without having to restart every time I switch the computer on?

    Is there a fix yet for the no sound problem with lion on the iMac without having to restart every time I switch the computer on?

    Try booting in Safe Mode by holding the the shift key immediately after powering on your system. Safe boot mode will for a directory check of your startup volume, then load only the required kernal extensions (kext files), and deletes some cache files. Once the system boots into Safe Mode you can simply restart the system to see whether the issue has been resolved.
    If you still have the issue try resetting the SMC by shutting down the system and disconnecting the power cord for ~15 seconds, then reconnecting the power cord. Next, reset the parameter RAM (PRAM) by holding down the option-option-P-R keys after powering ON the system. Wait until the iMac restarts twice, then let the system boot normally.

  • Use of Threads with JSP's

    Can you use threads in a web application that uses JSP's plus Servlets and Beans ?
    We have a JRUN 3.1 application using JSPs, Servlets and Beans. Shortly after we went live it became apparent that any 2 users using the same object experienced problems as one object was overwriting another. In a panic the problem was solved by whacking SYNCHRONISED on all objects.
    Now we want to write another application, are there strategies for using Threads with JSPs?
    Would this be part of the webserver configuration or would the application be coded in a certain way ?
    Please can you give me a simplistic answer or point me to some documentation that gives a simple overview.
    Thanks Steve

    Hi,
    You can use thread with jsp, i am sending u a example
    package thread;
    import java.io.Serializable;
    public class TaskBean implements Runnable, Serializable {
    private int counter;
    private int sum;
    private boolean started;
    private boolean running;
    private int sleep;
    public TaskBean() {
    counter = 0;
    sum = 0;
    started = false;
    running = false;
    sleep = 100;
    protected void work() {
    try {
    Thread.sleep(sleep);
    counter++;
    sum += counter;
    } catch (InterruptedException e) {
    setRunning(false);
    public synchronized int getPercent() {
    return counter;
    public synchronized boolean isStarted() {
    return started;
    public synchronized boolean isCompleted() {
    return counter == 100;
    public synchronized boolean isRunning() {
    return running;
    public synchronized void setRunning(boolean running) {
    this.running = running;
    if (running)
    started = true;
    public synchronized Object getResult() {
    if (isCompleted())
    return new Integer(sum);
    else
    return null;
    public void run() {
    try {
    setRunning(true);
    while (isRunning() && !isCompleted())
    work();
    } finally {
    setRunning(false);
    And JSP page start.jsp
    <% session.removeAttribute("task"); %>
    <jsp:useBean id="task" scope="session"
    class="thread.TaskBean"/>
    <% task.setRunning(true); %>
    <% new Thread(task).start(); %>
    <jsp:forward page="status.jsp"/>
    ///////////////// status .jsp
    <jsp:useBean id="task" scope="session"
    class="thread.TaskBean"/>
    <HTML>
    <HEAD>
    <TITLE>JSP Progress Bar</TITLE>
    <% if (task.isRunning()) { %>
    <SCRIPT LANGUAGE="JavaScript">
    setTimeout("location='status.jsp'", 1000);
    </SCRIPT>
    <% } %>
    </HEAD>
    <BODY>
    <H1 ALIGN="CENTER">JSP Progress Bar</H1>
    <H2 ALIGN="CENTER">
    Result: <%= task.getResult() %><BR>
    <% int percent = task.getPercent(); %>
    <%= percent %>%
    </H2>
    <TABLE WIDTH="60%" ALIGN="CENTER"
    BORDER=1 CELLPADDING=0 CELLSPACING=2>
    <TR>
    <% for (int i = 10; i <= percent; i += 10) { %>
    <TD WIDTH="10%" BGCOLOR="#000080"> </TD>
    <% } %>
    <% for (int i = 100; i > percent; i -= 10) { %>
    <TD WIDTH="10%"> </TD>
    <% } %>
    </TR>
    </TABLE>
    <TABLE WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
    <TD ALIGN="CENTER">
    <% if (task.isRunning()) { %>
    Running
    <% } else { %>
    <% if (task.isCompleted()) { %>
    Completed
    <% } else if (!task.isStarted()) { %>
    Not Started
    <% } else { %>
    Stopped
    <% } %>
    <% } %>
    </TD>
    </TR>
    <TR>
    <TD ALIGN="CENTER">
    <BR>
    <% if (task.isRunning()) { %>
    <FORM METHOD="GET" ACTION="stop.jsp">
    <INPUT TYPE="SUBMIT" VALUE="Stop">
    </FORM>
    <% } else { %>
    <FORM METHOD="GET" ACTION="start.jsp">
    <INPUT TYPE="SUBMIT" VALUE="Start">
    </FORM>
    <% } %>
    </TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>
    ////////////////////////////// stop.jsp
    <jsp:useBean id="task" scope="session"
    class="thread.TaskBean"/>
    <% task.setRunning(false); %>
    <jsp:forward page="status.jsp"/>
    deploy it into ur server and run start.jsp
    and see whatb happens

  • A Case Study Question in the Use of Stills with Final Cut Pro

    Believe it or not, for the last week I have been reading endlessly about pixels, resolution, aspect ratio, Photoshop resizing, the bloody battle over the usefulness of the term "dpi" in video discussions, and generally about what one should do in order to use still images in a film edited in Final Cut Pro. And yet, though I have a PhD from an Ivy League university, and can understand a lot of things, I am sorry to say I am still at a loss.
    Much of the discussions of photos on forums like this one are either quite technical or broadly philosophical. But my questions are completely practical and specific. I am not a photographer or a printer, nor am I an experienced editor. I am just a fairly smart person trying to use photos in his film. So I am going to ask some specific questions and hope for specific answers, without any philosophical waffling or technical mumbo jumbo.
    I have one of those HP all in one printer/fax/scanner machines. I am told this device, while not fancy, is perfectly adequate to the task. Some of my photos I scan with this device from prints. Some of them I get from other people. (I have stopped downloading photos from the web, as the quality is nearly always poor.) I have Photoshop Essentials (not Photoshop). I am making a 90-minute HDV documentary, 16x9. The doc is mostly HDV footage with a still here and there. I want to be able to move on the photos (zoom, pan, etc.). I want, obviously, for them to look good. My sense is that the work flow is: (a) scan the photo (or obtain from some source as a digital file); alter the photo in some way in Photoshop; and (b) import the photo into your FCP project.
    Question #1: If I have a 6x8 print, what settings should I scan it in with -- is it possible there really is no difference between scanning in it at 72dpi and 300dpi? Is it really all about the dimensions of the image? Isn't a photo whose dimensions are enlarged in Photoshop to make it available for panning and zooming in my sequence going to look fuzzier and more pixelated if it was originally scanned at 72dpi than at 300dpi? Also: Does it matter if I save it as a jpeg or tiff? Bottom line: What settings do I use in my scanning software when I scan a photo for this purpose?
    Question #2: Once I have the image file on my hard drive, I suppose I now have to load it into Photoshop Elements and do something to it. What is it exactly I am using this program for? I'm going to take a wild guess. I use PS Elements to (1) crop the photo so that it has a 16x9 aspect ratio, and (2) resize it so that I can do pans and other Ken Burnsy moves on it in FCP. Bottom line: What exactly do I do in PSE to the photo and what settings do I use to both (a) make it available for moves and (b) not injure the quality of the photo by increasing its dimensions?
    (In passing, I will say that I have done experiments that show that if I increase a photo's dimensions to, say, 4000 pixels by 2000 pixels, the photo's quality definitely and obviously suffers. I don't understand how a picture can be increased in size without losing sharpness. So, what am I doing wrong? Is this a function of it having been scanned in improperly to begin with?)
    Question #3: If I am obtaining a photo from an outside source -- say, a professional photographer -- what are the specifications I ask for in both a hard print and a photo file? If the former, what dimensions do I ask for? If the latter, do I specify resolution and dimensions and file type?
    These are my questions. At this point, I really don't want to know WHY any of this is the way it is. I just want someone to say: "Do this; do this; and then do this."
    Thank you very much.

    Studio X is absolutely correct; while DPI has no meaning in the video world, it often has significant meaning in scanning (and, of course, printing). If your scanning program only allows image size adjustments in DPI, then you'll have to adapt to that ... keeping in mind that the scanner's DPI setting directly relates to pixel resolution. And it is pixel resolution (not DPI) that will make all the difference in the world for images used in video. You can test this yourself by scanning an image at 1000 x 1200 @ 72 DPI and again at 1000 x 1200 at 300 DPI. They will look identical on TV or projection as long as the pixel resolution remains the same.
    As an example, my Epson scanning software allows me to adjust image size by DPI or pixel resolution. Wanting to maintain the correct aspect ratio for the image area that I'm scanning, I adjust the DPI setting which in turn adjusts the pixel resolution automatically. But it doesn't work the other way around; if I adjust the pixel resolution settings manually, the DPI setting does not change. Your software may vary.
    As Jim Cookman suggested, a scan setting of 300 DPI works well for most images ranging from 3 x 5 to 4 x 6 (typical snapshot size) in a DV Sequence. I may scan smaller images at 400 or 600 DPI and larger images (8 x 10 and up) at 150 DPI. Other size images fall in between those numbers. But I'm constantly watching the pixel resolution numbers to make sure I'm getting what I'll need to support the animation I intend to apply to the images once in FCP. Also bear in mind that I don't always scan the entire image. I only scan the area of an image that I intend to use in my program.
    So the answer is that it all depends on your scanner's software and how far you plan to push into an image once in FCP. Do a few experiments ... you're a bright fellow so it shouldn't take long for you to find the formula that suits your purposes.
    I haven't edited an HD Sequence using images yet, so I cannot offer definitive pixel resolutions for you there.
    On to your specific questions:
    1. See above. There is no one correct answer It all depends on what you intend to do with the image once it's in FCP. If you only plan to push in about 10%, you won't need much higher resolution than the equivalent of your FCP Sequence resolution. If you plan to push in further, you'll need a higher resolution to support that move.
    2. I've been doing these for many years (SD Sequences only) and I've never loaded them into Photoshop first. I import the entire folder into FCP and drop it on the Timeline so I can see what the images look like on TV; unless your program is for CD-ROM or web delivery, that's where it counts. When you place them on the Timeline, FCP will automatically scale to your Sequence settings and pixel aspect ratio. If I see that some of them need adjustment using an external editor such as Photoshop, then and only then do I use that program. And by the way, if you have a vertical image and a 16 x 9 aspect ratio in FCP, how do you propose to crop it to fit? Perhaps you meant another term instead of "crop."
    3. If it's a print, it won't matter what size they supply because you'll control the image size when scanning. If it's a file ... once again, the size (pixel resolution) depends on what you intend to do with the image once in FCP.
    I really don't want to know WHY any of this is the way it is. I just want someone to say: "Do this; do this; and then do this."<<</div>
    With that attitude, how did you ever earn a PhD from an Ivy League university? But if that is truly all you want, you might consider hiring an experienced editor to do it for you.
    -DH

Maybe you are looking for

  • MultiProvider Created from #.5 cube and 7.0 Cube

    I have one global cube created with update rules and transfer rules and everything, the way we create in BW 3.5 (Delivery) I have another newly created cube using BI 7.0 (History Delivery data) with Transformation and the DTP. I have created one Mult

  • Problems in Pages font panel

    I like Pages very much, but I have some questions: 1) The names of some fonts (True Type and post script type 1) are invisible or indeciferable in the font panel family column. How to make the name of font visible? 2) How can one remove a font from "

  • Norton ID Safe no longer shows up on the tool bar

    Norton ID Safe use to show up on the tool bar so you could log-in and access all your ID's and passwords when you entered a site. Your ID and PW would fill in automatically for each site that you had previously signed on too.

  • Change parameters on network interface card

    Hi, Ndd utility says that my ce0 adv_100fdx_cap, adv_100hdx_cap, adv_10fdx_cap, adv_10hdx_cap are read only. Can I set these capabilities to read write??? I'll get a permission denied message, if I try "ndd -set /dev/ce0 adv_100fdx_cap 1" in superuse

  • Camera och my 4S (iOS 5.0.1) stopped working today

    The app is stopping (freezing) before the shutters opening. Have restarted the unit by pressing power- and home button at the same time. Did also "reset all settings" Anyone any other suggestion? Thanks.