<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Sealyu

    --- 博客已遷移至: http://www.sealyu.com/blog

      BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評(píng)論 :: 0 Trackbacks

    Conversation timeout seems to be a commonly misunderstood Seam concept. I often see postings on the Seam forums claiming that the conversation-timeout doesn’t work! Well, actually it does, you simply have to understand the semantics.

    Configuring the conversation-timeout period can be accomplished through the following in your components.xml:

    <core:manager conversation-timeout="900000" />

    At first glance most developers relate conversation-timeout to session timeout, where any conversation will simply timeout after the configured conversation timeout period. As you will quickly notice during testing, this is not the case. To execute a quick experiment, try the following configuration in the components.xml of the seam-booking example:

    <core:manager conversation-timeout="60000" />

    Because the conversation-timeout is set in milliseconds, the above configuration sets the conversation-timeout to 1 minute. Now in the web.xml set the session timeout to 5 minutes:

    <session-config>
    <session-timeout>5</session-timeout>
    </session-config>

    Now in the destroy method of the HotelBookingAction add the following line:

    ...
    @Destroy @Remove
    public void destroy() {
    log.info("Destroying HotelBookingAction...");
    }
    ...

    This will log our message when the conversation ends and the HotelBookingAction is destroyed. Now deploy the seam-booking example to your local JBoss instance and start up a conversation. This can be accomplished by logging in, navigating to the hotels listing, and selecting a hotel for booking. At this point, wait for the 1 minute period… nothing happens. Now wait for another 4 minutes, the message is displayed. The conversation timed out along with the session.

    Foreground vs. Background Conversations

    So why didn’t our conversation timeout as configured? This is because the conversation-timeout only affects background conversations. The foreground conversation will only timeout when the session times out. Foreground, background, what? The foreground conversation is the conversation that the user last interacted with. A background conversation is any other conversation in the user’s session. Thus, in our previous scenario the foreground conversation timed out with the session as expected.

    Now lets try another approach. Perform the same steps as before to proceed to the booking screen. Now open a new window and perform the same steps. We now have a foreground conversation and a background conversation in progress. Again, wait 1 minute. Nothing happened. If you wait an additional 4 minutes, both conversations will timeout. So what is going on here, I thought we had a background conversation? We did, Seam simply checks the conversation timeout on each request. Thus, if I interact with the foreground conversation after 1 minute, the background conversation times out. Try it, perform the same steps, wait 1 minute and then click on the window of the foreground conversation and you will see the log message.

    This is very desirable behavior. Essentially when a user leaves his or her desk for a period of time and comes back, if the session is still active it would be desirable to maintain the state the user was previously in. This is the foreground conversation state. All other background conversation state is left to timeout after the configured conversation-timeout period which reduces overall memory consumption. This enables a developer to think less about memory usage and cleaning up state and more about developing business logic. That’s why we’re here right?

    Letting the user choose

    So you may be asking at this point why the conversation-timeout doesn’t use polling. As we said, you must interact with the foreground conversation to cause the background conversations to timeout after the conversation-timeout period. Imagine that the user had many windows open and leaves his or her desk. Based on which window the user clicks on when they return, that becomes the foreground conversation timing out any other background conversations. This gives the user a chance to resume whichever conversation he or she chooses, not the one the developer chooses.

    posted on 2010-04-20 00:36 seal 閱讀(453) 評(píng)論(0)  編輯  收藏 所屬分類: Seam
    主站蜘蛛池模板: 成人毛片免费视频| 亚洲av无码偷拍在线观看| 免费一级毛片正在播放| 97免费人妻在线视频| 国产精品美女久久久免费| 亚洲乱码中文字幕在线| 亚洲成电影在线观看青青| 亚洲国产精品一区二区成人片国内| 国产又黄又爽又猛的免费视频播放| 9久9久女女免费精品视频在线观看| 国产婷婷成人久久Av免费高清| 黄页网站在线观看免费高清| 好湿好大好紧好爽免费视频| 看亚洲a级一级毛片| 精品亚洲成在人线AV无码| 久久亚洲日韩看片无码| 亚洲av无码精品网站| 伊人久久精品亚洲午夜| 亚洲AⅤ优女AV综合久久久| 国产成人精品123区免费视频| 成人免费福利电影| 国产日本一线在线观看免费| 国产1000部成人免费视频| 久久国产色AV免费观看| 香港a毛片免费观看 | 国产午夜无码片免费| 免费无码国产V片在线观看| 亚洲AV永久无码精品一百度影院| 亚洲国产av无码精品| 亚洲国产成人久久笫一页| 亚洲av无码乱码在线观看野外| 免费看男女下面日出水视频| 国产人妖ts在线观看免费视频| 永久免费毛片手机版在线看| 免费视频淫片aa毛片| 免费看国产一级特黄aa大片| 亚洲国产免费综合| 国产亚洲情侣一区二区无| 亚洲欧洲日产国码无码久久99| 亚洲精品亚洲人成人网| 亚洲欧洲日韩国产综合在线二区|