Timeout on a Function

Hi Everybody,
I am writing a java program that reads the contents of the mails in a mailbox.I was using JavaMail for this and I using IMAP protocol. I noticed that once in a while some mail is corrupted and I cannot get its content. The program gets struck on message.getContent(). I wanted to handle this situation in my code, by moving to the next mail if it takes more than 20 seconds to get the content of the mail. I was wondering how I can accomplish this in java. I basically want to interrupt the method call message.getContent() it it takes more than 20 sec. Any help is appreciated.
Regards,
Tarun

easiest thing to interrupt is a Thread, so Thread looks good....
things in a Thread that can be used to respond to Thread.interrupt() are just about all blocking functions, ie most/ if not all I/O, which is probably where your program will be hanging

Similar Messages

  • Timeout in Block Function doesn't work

    Hi, I'm using a BLOCK FUNCTION, with a timeout of 3 minutes from a attribute type, I wait for about 10 minutes, but the process still blocked... what's wrong ? can't I use a block function with timeout, or the block process need to be completed by CompleteActivity() function before the timeout engine check for that.
    Thanks.

    No, you don´t have to use completeActivity.
    I think you are missing something.
    Did you start your background engine?
    Regards,
    Luiz Soares

  • Timeout and respond function modes

    I was just wondering if i add TIMEOUT feature in my custom workflow, then on TIMEOUT, will the code in (FUNCMODE = 'RESPOND') execute along with the code i write in (FUNCMODE = 'TIMEOUT') ?
    This is really important for me before proceeding furthur. Any help is really appreciated.
    Thanks!!!!
    Jim

    Jim , just to confirm , only the code in (FUNCMODE = 'TIMEOUT') within the post notfication function will execute.

  • Timeouts when calling functions

    We have an application that makes use of functions within SAP.  We call these functions with v2 of the .NET connector but occasionally these take quite long and either the user sits twiddling their thumbs for ages or a SAP dump is produced and the application crashes.  I have two questions:
    1) Can we stop a function call after we have started it? (Note: The function module is executing ABAP created from the application)
    2) What is the best way to deal with timeouts?  (Is there anyway to stop the dump from being produced?)
    TIA,
    -Charles

    The connector allows you to do asynchronous calls to the ""proxied"" RFC functions.
    This way you can define your own "timeout".
    Regards,
    Ofer

  • Visa Set Timeout Or Wait Function

    Hi guys, I want that my VISA waits for a certain number of seconds doing always the same operation.
    The first  idea I had is shown in Immagine, after that I saw the Visa set Timeout but I haven't understood how it works.
    What I want is that the instrument I'm controlling stays in the :TRACe1:MODE MAXHold (without resetting the comand, so no cicle) until I want.
    Which is the correct solution?
    Attachments:
    Immagine.PNG ‏66 KB
    Immagine2.PNG ‏80 KB

    Hi Kate first of all thank you for your reply so the second one should be used between the write&read visa function, is it correct? For example when I want acquire the data from the instrument I should give some time between the instruction sent with the Write Visa and the feedback received from the Read Visa, have I understood well?
    Another thing about the first immage using this configuration  are you sure that the last value that I read from the instrument will be the result of all the things seen from 0 to 20seconds?
    You will find the reason of this question watching the immage attached. As you can see the doubt I have is that the output of the image2 is the same of the input of the image1.
    To be more accurate the instruction :TRACe1:MODE MAXHold has this function: Maintains the minimum for each point of the trace, and updates each trace point if a new minimum is generated in successive sweeps.
    So what I want to see is the final result of the successive sweeps, for example the final result of all the sweeps after 20 seconds.
    I hope that this clarify you what I'm asking for.
    Attachments:
    Immagine.PNG ‏77 KB
    Immagine2.PNG ‏77 KB

  • 997 Acknowledgement Timeout Settinsg - X12 EDI

    Hi,
    In Covast, there is an option setup for timeout period on functional and technical acknowledgements. Can we setup same on BizTalk Server 2013? How would system know that the particular interchange did not receive the 997s in predefined time?
    For example, if I don't receive 997s within 72 hours, I want to have a report of those interchanges.
    Any help on putting me in right direction will be appreciated.
    Thanks

    EDI Status Reporting is what you would use for this:
    http://msdn.microsoft.com/en-us/library/bb226463.aspx

  • Configure RMI Timeout?

    Is there any way to control the timeout for a RMI call in 10.1.2.2 (heck, in any version of the Oracle app server)?
    We have several business services exposed using SessionEJBs on a backend business server. However, if the call to these methods take more than about 30 seconds to complete we receive the following exeption (even if it the operation completed successfully):
    com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: timed out;
    How can we set the length of time before this timeout error will be generated? I'd like to ensure that in the event of long-running operations the request will not timeout and the function can complete normally. It makes sense to set some kind of a timeout but seems there should be some way to control this value based on the specific operation being performed.

    Michael,
    We use the [System] property "rmi.client.connection.timeout".
    You can set it when you launch OC4J stand alone using the "-D" option of the java command, for example:
    java -Drmi.client.connection.timeout=10 -jar oc4j.jarShould set the timeout to ten (10) seconds.
    Good Luck,
    Avi.

  • Sleep / wait function for Business Server Page

    Hi friends of BSP,
    on my BSP I generate at the onload function x iframes for calling BEx 7.x WebTemplates.
    It is a dynamical count of iframes depending on some URL parameters.
    Now, I get the problem, that if the count of iframes is to big, the system can not load all WebTemplates, because they are generated to fast and the system can not handle this amount of processes.
    Is there a possibility to include a wait or sleep function?
    If the answer is "yes", how to implement those functions?
    thanks for any help and support
    kind regards
    Patrick

    Hi Jamie,
    now, we us the JS method window.setTimeout().
    But there are some restrictions.
    In BSP Applications this method works only if the delayed functions is the same function calling the delayed function
    function delayFunction(index)
      var timeout
      timeout = window.setTimeout(function() { delayFunction(i) }, 1000);
    and the delayed called has to be the last step of the function
    (for exmaple there is no possibility to include the setTimeout-function in an IF condition or in any loop).
    Many thanks
    Kind regards
    Patrick

  • Screen Timeout - Advanced Calling Update

    My phone's screen timeout is not functioning since the Advanced Calling update.  The screen turns on randomly and will not timeout automatically.  This has only been present since the update and has been an issue at nights, with the screen automatically turning on and failing to turn off, draining battery percentage.  Has anyone else experienced this?

    No issues here.  My G3 has been no different since the update except the quality of calls is through the roof.  A call has never sounded better.  I sound like I'm on a landline.  I'm actually considering dropping my home phone now.

  • Controlling cFP FP_Read() Timeout

    I am using the cFP-1804 controller, CVI 2009, trying to determine if the cFP rack is responding during initialization. Plan A is to do a an FP_Read at regular intervals, looking for an error.
    Is there a way to control the cFP FP_Read timeout period?  When the rack is not connected, the timeout appears to be ONE MINUTE.  During that time, the application main thread is locked.
    It seems to me that 5 seconds or even 1 second should  be sufficient. 
    Plan  B is to use InetPing, but that has issues also.

    Hello hendray@ngms,
    I do believe I'm assisting you with another post as well
    From what I can tell about the cFP Read, there is not a parameter we can set to control the timeout of the function. This appears to be a limitation of the lower level driver we use for the cFP. I went all the way into the DLL to see if this was a parameter we could set, but couldn't find a specific timeout setting.
    I did update the other post with information about using a network watchdog, which seems like it may be the best bet for your application.
    Stephanie O.
    DIAdem Product Manager
    National Instruments

  • Mobile List Bind aggregation - repeated values?

    Hi all, i'm new to SAPui5 so please forgive me if this is already discussed.
    I'm calling a odata service (http://h03zdb.hcc.uni-magdeburg.de:8003/workshop/sessiona/12/Services/msgTab.xsodata/MSGTABLE?$filter=FROM%20eq%20%27STU…) and I get the values stored in a table in json. I want to show this in a list but there are repeated values created for the list. Is it because of bindAggregation?

    Here is the whole code.
    I used split app and added two models for the detail and master page.
    I'm very new to this so sorry for bad coding
    <html>
      <head>
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <title>SRH Chat</title>
      <script src="/sap/ui5/1/resources/sap-ui-core.js"
      id="sap-ui-bootstrap"
      data-sap-ui-libs="sap.m"
      data-sap-ui-theme="sap_bluecrystal">
      </script>
      <!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->
      <script type="text/javascript">
      var sessionKey = "STUDENT01";
      // Login user to get session id
      var oDetailPage2 = new sap.m.Page("detail2");
      var url = "http://h03zdb.hcc.uni-magdeburg.de:8003/workshop/sessiona/12/Services/msgTab.xsodata/MSGTABLE?$filter=TO%20eq%20%27"+sessionKey+"%27%20&%20FROM%20eq%20%27"+sessionKey+"%27%20&$format=json";
      $.get( url, function(data1) {
      // create JSON model instance
      var oModel = new sap.ui.model.json.JSONModel();
      // set the data for the model
      oModel.setData(data1);
      // set the model to the core
      oMasterPage1.setModel(oModel);
      var contactList = new sap.m.List("newlist2",{
      title : "{FROM}",
      mode: sap.m.ListMode.SingleSelectMaster,
                select: function(oEv) {
      var item = oEv.getParameter("listItem");
      var desc = item.getTitle();
      retrieveMsgs(desc);
      function retrieveMsgs(desc)
      var aurl = "http://h03zdb.hcc.uni-magdeburg.de:8003/workshop/sessiona/12/Services/msgTab.xsodata/MSGTABLE?$filter=FROM%20eq%20%27"+desc+"%27%20&$format=json";
      $.get( aurl, function( data ) {
    // // create JSON model instance
      var oModel1 = new sap.ui.model.json.JSONModel();
    // // set the data for the model
      oModel1.setData(data);
      // set the model to the core
      oDetailPage2.setModel(oModel1);
      var contactList1 = new sap.m.List("newlist");
      var inputField = new sap.m.TextArea();
      var but1 = new sap.m.Button({text: "Send", tap: function(){
      // Send button press functionality
      var msg = inputField.getValue();
      var murl = "http://h03zdb.hcc.uni-magdeburg.de:8003/workshop/sessiona/12/WebContent/InsertMsg.xsjs?from="+desc+"&to="+sessionKey+"&msg="+msg;
      $.ajax({
            url: murl,
            type: 'POST',
            async: false,
            timeout: 30000,
            success : function (data2){
            var empty = "";
            inputField.setValue(empty);    // clear text area
      //Populate the List with Data from the Model (Set in the Controller of this View)
      contactList1.bindAggregation("items", {
      path : "/d/results", //Reference to the JSON structure
      template: new sap.m.StandardListItem({
      title: "{FROM}", //Refer the name field in the JSON data
      description: "{MSG}", //Address Field in the data
      type: sap.m.ListType.Navigation //Specify what to do while clicking/tapping an item in the list, in this example navigate to another view
      oDetailPage2.addContent(contactList1);
      oDetailPage2.addContent(inputField);
      oDetailPage2.addContent(but1);
      oSplitApp.to("detail2");
      //Populate the List with Data from the Model (Set in the Controller of this View)
      //oModel.createBindingContext("/d/results", null, {select: "FROM"},function(a){});
      contactList.bindAggregation("items", {
      path : "/d/results", //Reference to the JSON structure
      template: new sap.m.StandardListItem({
      title: "{FROM}", //Refer the name field in the JSON data
      //description: "{FROM}", //Address Field in the data
      //select: "FROM,TO",
      type: sap.m.ListType.Navigation //Specify what to do while clicking/tapping an item in the list, in this example navigate to another view
      var oMasterPage1 = new sap.m.Page("master1",{
        title : "Master"
      // adding the list to master
      oMasterPage1.addContent(contactList);
    // //add the master pages to the splitapp control
      oSplitApp.addMasterPage(oMasterPage1);
    //   .addMasterPage(oMasterPage1);
      //add the detail pages to the splitapp control
      oSplitApp.addDetailPage(oDetailPage2);
      //oSplitApp.setInitialDetail("detail");
      //oSplitApp.setInitialMaster("master");
      oSplitApp.placeAt("body");
      </script>
      </head>
      <body class="body">
      <div id="body">
      </div>
      </body>
    </html>

  • Issues in running scripts from OTM

    Hi ,
    I have created an endtoend scenario where the script starts from creating requistion, approval, PO creation approval , receipt creation then Invoice and payment.
    My script failing with different reason for different runs. Mailnly its failing whenever the steps are referrred to Standard Oracle Forms.(Eg: Invoice Batch, Receipt Form etc).
    I am running this from machine where Openscript and OTM is installed.
    I tried the command line arugment like " -delayPercentage -1 -delayMin 1 -delayMax 20 " while running the script from OTM. Still issue is same. If I am not using this commad the script steps deviates and failing. I mean in script the step is to choose some responsibility A it is choosing B. To override think times recorded I have used thread.sleep(2000) after every thinktime entry to run it from openscript.
    and to run it from OTM I am using above command.
    Now can anyone suggest me is anyother way that we can overcome these timeout errors. Am I using command line argument in correct way ? Please help

    Hi,
    First try your playback from OpenScript.
    Before play back go to View -> OpenScript Preferences -> PlayBack -> Oracle EBS/Forms Functional
    Increase timeouts in Event Timeout. Also Increase timeout in Web Functional (Object timeout)
    Then Apply and OK    
    Now try play back from OpenScript
    Regards,
    Deepu M
    [email protected]

  • Why won't my JQuery AJAX Work?

    I've used AJAX and JQUERY AJAX before, but I can't get it working in Dreamweaver with a test PhoneGap site.  I'm pasting in my code below. 
    I put some alerts in, one to let me know the event got inside the "change" fuction (that works).  Then I have another after the AJAX and it doesn't.  The dropdown hangs and doesn't even close.  I don't get a success, a failure or even a timeout!  WTF?  I have the URL destination in the same folder and I've tried adding the localhost and leaving it off, but to no avail.
    HELLLLPPPPP!!!
    -- John Kiernan
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>jQuery Mobile Web App</title>
    <link href="jquery-mobile/jquery.mobile-1.0a3.min.css" rel="stylesheet" type="text/css"/>
    <script src="jquery-mobile/jquery-1.5.min.js" type="text/javascript"></script>
    <script src="jquery-mobile/jquery.mobile-1.0a3.min.js" type="text/javascript"></script>
    <!-- This reference to cordova.js will allow for code hints as long as the current site has been configured as a mobile application.
         To configure the site as a mobile application, go to Site -> Mobile Applications -> Configure Application Framework... -->
    <script src="/cordova.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function(){
      $("#mainPulldown").change(function(){
        var lcUrl = "http://localhost/populatestate.php";
    //This gives me an alert letting me know the function is firing   
        alert(lcUrl);
        $.ajax({
        type: GET,
        url: lcUrl,
        data: {'which':'USA'},
        dataType: "json",
        timeout: 30000,
        success: function(json) {
          alert("success");
        error: function(x,y,z) {
        // x.responseText should have what's wrong
          alert(x.responseText);
        //  alert("Bad");
        statusCode: {
        404: function() {
          alert("page not found");
    alert("timeout");
    </script>
    </head>
    <body>
    <div data-role="page" id="page">
        <div data-role="header">
            <h1>Page One</h1>
        </div>
        <div data-role="content">   
            <div id='maindiv' style='height:52px;overflow:hidden; ' align='center'>
                    <select id='mainPulldown'  name='mainPulldown' >
                        <option value='Select' selected='selected'>Choose a location</option>
                        <option value='USA' >U.S. States/Territories</option>
                        <option value='CANADA'>Canada</option>
                        <option value='MEXICO'>Mexico</option>
                        <option value='AUSTRALIA'>Australia</option>
                        <option value='BRAZIL'>Brazil</option>
                        <option value='GERMANY'>Germany</option>
                        <option value='Country'>Other Countries with Meetings</option>
                        <option value='Enter'>Enter free form address</option>
                    </select>
            </div>
            <div id='statediv' style='height:auto;overflow:hidden;' align='center'>
                <form method='get' id='stateform' action='#' onsubmit='return false;' style='text-align: center;'>
                    <select onchange='getnext(this.options[this.selectedIndex].value, this.id)' id='statePulldown'>
                        <option value='Select'>Choose a State</option>
                    </select>
                </form>
            </div>  
        </div>
        <div data-role="footer">
            <h4>Page Footer</h4>
        </div>
    </div>
    </body>
    </html>

    I got the AJAX working.  It turned out I had GET instead of "GET" in the ajax call.
    What makes it maddening was I cut and pasted it from somewhere on the net that said it worked.  Argh.
    HOWEVER...
    Now I have another problem.  I'm trying to set up a cascading dropdown and I have data flowing back in JSON form and it LOOKS like it's populating the SELECT, but when it's done the length of the SELECT is still 1.
    Any ideas?  I've put JavaScript alerts in to show you and I have two different ways of populating the dropdown and neither worked -- nor did the old fashioned "target.options[i] = new Option(opttext,optvalue )".
    HELP!
    Again, the link is:  http://kierpro.com/aatest/index.html

  • Asynchronous socket programming in Java?

    I am a C++ programmer, I just wonder how do I do asynchronous programming in Java?
    In VC++, you can hook an event handler to the socket and the system will fire an event whenever there is data coming in to the socket. The event handler can then spawn a thread and handle the network message.
    In Unix, you can use the select() function. This function will return whenever the indicated socket fires events. If nothing happens within the timeout period, the function simply returns.
    What about in Java? I don't see any methods that allows you to hook an event handler to it. Is there anything like select() function in Unix?
    Thanks so much.

    There is something very much like C's select: selectors. I don't immediately know where to read more about them but google for things like "java selector example", "java nio tutorial", etc (NIO = new I/O, the library where selectors live.)
    Another way to do async sockets in Java is by threading. That is the traditional way before New I/O. It's still a perfectly good and easy way, thanks to Java's easy threading. Downside is that it scales to only maybe 100-200 simultaneous connections per server (will depend on your operating system). For thread-based sockets check Sun's Java socket tutorial (first item when you google "java socket tutorial").

  • Synchroniz​e hardware timed buffered counter acquisitio​n with buffered analog input acquisitio​n

    LV7.1
    DAQmx
    PCI-6036E
    SC-2345
    Windows 2000
    Greetings.
    I am simply trying to synchronize AI readings with readings from one Counter.
    I am trying to perform buffered analog input synchronized with buffered counter acquisition.
    I'd like the AI acquistion to trigger the Counter acquistion.
    I'm currently setting the Sample Clock Source for the CI Cnt Edges Task to "Dev1/ai/SampleClock" but when I try and set the source for the "DAQmx Trigger" I can't seem to select one that works. I assumed that the source should be the "Dev1/ai/StartTrigger" but that produces and error as does selecting any of the PFI's.
    I'm new to DAQmx and didn't have any luck with the examples or what's been previously posted.
    Thanks for your help.
    Attachments:
    Initialization.jpg ‏84 KB

    Gentlemen-
    All of your initial help was great. I had some noise on my counter lines so switched from an E-Series card to a PCI-6259 M-series card in order to use the counter digital filters.
    Now I can't get a corellated buffered counter and buffered analog input acquistion to work. This same code worked fine on an E-series card but it doesn't on the M-series.
    I verified that the source and gate of the counter are working properly using the test panel and a external function generator.
    But when I run the attached code I get no data out of the "Counter 1D U32 NSamples", only an error saying that the timeout of the function was reached and no count data became available. Am I missing the specification of a another clock or something?
    The counters also work fine using the M-series example code "Count Digital Events (M-Series DAQmx) but this is not a buffered acquisition.
    Any help would be greatly appreciated.
    Steve
    Attachments:
    Sample_Code.jpg ‏136 KB

Maybe you are looking for

  • Can I use a MIDI keyboard as an input device for a software instrument?

    I have a Casio CTK-2100 that I am currently playing around with in Logic Pro 9. It can record and playback the different instruments fine using MIDI tracks. But I was wondering if it is possible to use the keyboard as an input device for a software i

  • Old version of Camera Raw toolbar in photoshop cc

    Hello Guys, I'm hoping someone can help me with this problem that's been driving me nuts for a couple of weeks now. I have the very latest version of Photoshop CC - when I bring up Camera Raw in Photoshop (Filter-Camera Raw Filter), the toolbar at th

  • How do you open Illustrator CS6 files in CS5

    how do you open Illustrator CS6 files in CS5

  • Ringtones I downloaded I can't find

    I received a text that the ringtones I bought were downloaded but I can't find them. I have downloaded games and was able to successfully retrieve them. I am not sure if I am looking in the wrong app or if I wiped then out Thanks for any help

  • Is there a Snaplab plugin for Adobe CS6

    The Snaplab plugin I have now works great on CS5, but, doens't seemt o show up with CS6. Is tehre an update for making Snaplab borders for Win8 and Adobe CS6 or CC? A bonus would be to have drivers for the Snaplap CR10L and the DR150 for Windows 8...