Wait and Timeout

Hi All
I have a task, I need to execute this task only if I meet a condition.
I wrote the function
didIMeetCondition()which returns boolean.
I have a threshold value of time to which I can wait till my condition returns true.
After the threshold I need to throw exception if y condition return false.
How do I write code to do this. Just psuedo code is sufficient.
Any ideas, please let me know.
Thanks
Bib

Untested code below - just an example. Extending Runnable, using swing Timer, etc may be better options in the end ... but just an example here.
public class HypotheticalTimer {
  private boolean timeOut;
  public HypotheticalTimer() {
    new TimeKeeper(30).start();
    didIMeetCondition();
  public class TimeKeeper  extends Thread {
    int interval;
    public TimeKeeper(int _interval) {
      interval = _interval;
    public void run() {
      try {
        Thread.sleep(interval*1000);
        timOut = true;
      } catch(InterruptedException ie) {
  public void didIMeetCondition() { // probably synchronized?
    while ( !timeOut) {
      /* whatever conditions need to be considered, etc. */
  }~Bill

Similar Messages

  • Advice needed on Waits and Timeouts - 8i on HPUnix

    I need some straight advice...We are running 8i on HPUnix. We have been tuning this thing for 6 weeks now and have most things under control (disk I/O, various cache hit ratios, etc.)...but...we still see a large number of waits...at least I think its a large number.
    Question 1. If the instance has been up for 72 hours and I see a count of io done waits for DBW0 of 2,966,179 with 78041 timeouts (as an example), is this a large number? Nothing I have seen in the Oracle documentation gives me a sense of scale.
    Question 2. What events do we have the ability to tune?
    Question 3. For those that we can tune...how do you tune them?
    Kurt
    813 483 2153

    I need some straight advice...We are running 8i on HPUnix. We have been tuning this thing for 6 weeks now and have most things under control (disk I/O, various cache hit ratios, etc.)...but...we still see a large number of waits...at least I think its a large number.
    Question 1. If the instance has been up for 72 hours and I see a count of io done waits for DBW0 of 2,966,179 with 78041 timeouts (as an example), is this a large number? Nothing I have seen in the Oracle documentation gives me a sense of scale.
    Question 2. What events do we have the ability to tune?
    Question 3. For those that we can tune...how do you tune them?
    Kurt
    813 483 2153

  • BPEL Correlation and timeouts

    Hello,
    I'd like to ask question regarging BPEL correlation and timeouts.
    According to BPEL SE lifecycle schema - if BPEL SE receives message with defined correlation and value of the correlator in message doesn't match any active process instance BPEL keeps message waiting for process instance with particular correlation value
    This behaviour is undesirable in situations where no process with particular correlator ever appears.
    If the BPEL client is connected via HTTP/SOAP BC, then client timeout will just terminate HTTP connection to binding component, message exchange between BC and BPEL isn't closed.
    I cannot manage to cancel connection due to timeout from EJB (if BPEL client is EJB, so it is connected via JavaEE SE).
    Is there any possibility in BPEL SE to refuse messages correlated to non-existing process instances? Or is there any possibility to set client timeout from SOAP BC or J2EE SE on message-exchange level?
    Vladimir

    This is a feature that we would like to provide in the BPEL SE. In the immediate future we may be able to address this in part specifically the case you mentioned. The other cases that also needs to be addressed is where the incoming message's correlation ID matches with a running instance, but doesn't get consumed because the instance never took the path of consuming the message. These other use cases will be addressed as a feature later.
    thanks,
    -Kiran B

  • Get_sqlagent_job_status long durtions and timeouts

    Hi,
    In Reporting Services, ReportSever database there is the Get_sqlagent_job_status procedure. This procedure is calling the undocumented system procedure xp_sqlagent_enum_jobs to
    check the subscription jobs statuses. In most of the times the execution finishes in milliseconds. In rare cases however, the execution is taking much longer and when it reaches 30sec procedure is timing out with the following error:
    Msg 22023, Sev 16: SQLServerAgent exceeded the allowed timeout for
    creating the shared job list.  The Jobs cannot be enumerated.
    During long executions the wait type is MSQL_XP. Regarding msdn it:
    Occurs when a task is waiting for an extended stored procedure to end. SQL Server uses this wait state to detect potential MARS application deadlocks. The wait stops when the extended stored procedure call ends. 
    My question is why sometimes the xp_sqlagent_enum_jobs procedure is running longer and timeout? I couldn’t trace on which resources or processes it is waiting. When searching the
    Microsoft sites, I only found info that this is undocumented procedure and should not be used. Why then then it is being used in the ReportServer database that is being setup during the Reporting Services installation.
    What can be done to get rid of the timeout errors from Get_sqlagent_job_status procedure?
    I hope anyone can help.
    Regards,
    Marek

    Hi. We have the exact same problem. We have put in all the notes mentioned here and more.
    We have looked at the variant and have restricted it as much as possible, but we create about 30000 carts a month and some of them are not complete for a long time so we can not restrict the days too much.
    We try to run BBP_GET_STATUS_2 for 90 day timeframe, as this covers much of it, but it takes over 10 hours to run.
    We would then want to run more than 90 days once a week or something, but this takes 24 hours to run.
    Does anyone have any more ideas how we can improve this?
    I am thinking about stopping running the program and use a user exit in MIRO and MIGO to RFC into SRM and run the program for just the 1 applicable cart at a time, but this seems a bit drastic.
    I have asked SAP all this but they told us the same as above, try the notes, restrict the variant.
    Regards,
    Dave.

  • Help with Runtime class and timeout of Process

    Hi,
    Question regarding using Runtime class, and yes I have looked at the javadocs, but I am still confused and frustrated.
    Here is part of my code.
    Process p;
    Runtime runtime = Runtime.getRuntime();
    p = runtime.exec("rsh localhost ls");
    if you are not familiar with rsh all it does is remote shell into the computer localhost and executes the command ls.
    Now, I dont have rsh running on my computer so it will hang at that line for about 40 sec and eventually time out on its own. Is there anyway I can specify a timeout argument like there is for the ping command? Like if there is no response from localhost after 3 sec, then just kill the process?
    I looked at the Runtime javadoc and Process javadoc and the closest thing I could come to with is something to do with envp (environment parameters), but I dont know what that is.
    Thanks guys.

    You can't timeout the "runtime.exec("rsh localhost ls");" call but if you execute the call in a seperate thread you can "timeout" and continue executing on the original thread (while letting the "runtime" thread to timeout on its own).
    Check the following class that I created for cases like this:
    abstract public class TimeoutHelper implements Runnable
        private Throwable error;
        private boolean running = true;
        private Object retValue;
        protected String name;
        private long waitTime;
        private Thread thread;
         * Creates a new helper. Use {@link #start} to run the code.
         * @param name A name that will be used in the helper thread name
         * @param waitTime The time (in msec) to wait before timeout.
        public TimeoutHelper(String name, long waitTime)
            this.name = name;
            this.waitTime = waitTime;
        public Object start() throws Throwable
            return asyncExecute();
        abstract protected Object execute() throws Throwable;
        private synchronized Object asyncExecute() throws Throwable
            createThread().start();
            if (running)
                try
                    wait(waitTime);
                    if (running)
                        // Timeout!!
                        abortThread();
                        throw new TimeOutException("Timeout for: " + name);
                catch (InterruptedException ie)
                    // Ignore
            if (error != null)
                throw error;
            return retValue;
        private void abortThread()
            if (thread != null)
                thread.interrupt();
        protected Thread createThread()
            thread = new Thread(this, name);
            return thread;
        public void run()
            try
                retValue = execute();
            catch (Throwable th)
                error = th;
            synchronized (this)
                running = false;
                notifyAll();
    }You use the class by extending it and implementing "execute". For example:
            TimeoutHelper helper = new TimeoutHelper("Runner", 5000)
                protected Object execute() throws Throwable
                    Runtime runtime = Runtime.getRuntime();
                    return runtime.exec("rsh localhost ls");
            try
                Process p = (Process)helper.start();
            catch (TimeOutException e)
                // Handle timeout here
            catch (Exception e)
                // Handle other errors here.
            }

  • Mark waiting and cancelled tasks completed

    Hi All,
    is there sql somewhere that can mark certain tasks that are in waiting and canceled status to Completed?
    Thanx.
    Fred

    I would suggest using the APIs to update the status or use the manuallyComplete API instead.
    -Kevin

  • Ipad App Store said "20" updates.  I attempted to update w/3G.  Now many apps say "Waiting" and are frozen.  When I go online and plug into computer it just updates and doesn't address the individual apps, which still say "Waiting" and are frozen.

    iPad App Store app said "20 updates".  Attempted to update w/3G.  Updated some, but now many apps say "waiting" and are frozen.  I attempted to update then by attaching to computer Itunes Store.  All it did was very quickly go thru the 4 steps and said, "Synched, OK to uplug."  I clicked my ipad and then apps.  It also said Update complete (or something like that).  Now several apps on iPad are frozen and say "Waiting".  Help!!

    Oh a few other things I forgot.
    The long winded back-ups!!!! JESSSSSSH! Although I think the latest update seems to have bit into this a bit.
    Also why is it that sometimes when the iPhone is syncing it will not say on the actual iPhone that it is syncing. I see it's syncing in iTunes but the iPhone doesn't have the typical do not disconnect -syncing message!!! What's odd is I can see the new apps being updated to the iPhone and as long as I don't open any apps it will finish it's sync but the minute I open any apps the iPhone will lock-up!!!

  • Hi I am having problems downloading and updating apps on my iPad and iPhone. The message cycles between waiting and loading then I get an error message saying unable to download app. Eventually,after many attempts it works.

    Hi Guys - for a few days I have been having problems downloading and updating apps on my iPad and iPhone. The message cycles between waiting and downloading then eventually says unable to download app. Sometimes after many attempts it wil eventually work. I tested it on an old iPhone 3G and got the same problem so it is not an iOS 5 issue. My WI-FI connection is working fine. I was wondering if this is an App Store problem? Anyone else in the UK having this problem?

    Hi John
    iTunes Support wasn't of any use to me.
    I have also been having another problem - with BBC iPlayer and other video streaming not working due to insufficient bandwidth, despite my overall download speed being consistently around 50Gb.  This is also affecting AppleTV downloads
    I am using Virgin Media as my ISP, and was wondering whether you do as well.  This might be the common thread.
    -Bernard

  • TS3274 I just synced my old iPad to my new iPad....the apps show "waiting" and I do not know why

    I just synced my old iPad to my new iPad....the apps show "waiting" and I do not know why.  It has been 2 days.  I wiped my old iPad even?

    Connect to iTune; and Check for available download (under Store). When download is completed, sync to iPad.
    http://i1224.photobucket.com/albums/ee374/Diavonex/f5c1b271.jpg

  • Session: Waiting and Working Chart

    I am using OEM 10g (Grid control) to monitor my database.
    But I don know what does the Y axis on the chart (Session: Waiting and Working) mean ?
    Thanks for your help.
    Note: Click Home page -> Database -> Performance -> Sessions: Waiting and Working.

    2 store the user name in the session to display as a welcome message to the user when they are logged in.]
    in class where you match the username and password .if given user is exist in records then set it into session
    HttpSession session =request.getSession();
    session.setAttribute("",);
    3 tell the user they dont exist in the database or that there password is wrong and give them the option to either A) reset the password or B) create a user
    in same class if user does not exist the redirect the request to different pages in that pages you put these two like A) reset the password or B) create a user

  • Bought Premier Elements yesterday. EVERY time I try to open a set of clips with Editor, I am told I have to sign into my Adobe first. I do this and wait for several minutes for the password dialogue box to open, enter my password. then wait and wait until

    Bought Premier Elements 13 yesterday. EVERY time I try to open a set of clips with Editor, I am told I have to sign into my Adobe first. I do this and wait for several minutes for the password dialogue box to open, enter my password. then wait and wait until my pw is recognized. Accept agreement. Agreement screen disappears and I'm back where I started. Try to open video clips with editor again and get the same demand to log in. Please advise asap. thx

    Oldcameraman
    Please do not duplicate a thread. The threads are answered as soon as possible. We are not Adobe. Just user to user.
    I have answered your most recent of the duplicates
    Premier Elements 13 Organizer Works. Editor doesn't. Log in doesn't work
    It is uncertain just how far we can go to help you since you do not appear to have Premiere Elements any
    longer.Seems you demanded a refund from Adobe Chat, got it, and now are left with a non purchased program which I
    am not sure can be used.
    Duplicates tend to confuse the person asking the question as well as those attempting to reply. As I suggested in the
    above mentioned thread, try to sort out your situation with Adobe via its Adobe Chat.
    ATR

  • I am in Saudi and trying to download navigon middle east. Every time I try to buy the app it will show up, says waiting and disappears. How can I get around it and not get lost on these crazy roads?

    I am in Saudi and trying to download navigon middle east. Every time I try to buy the app it will show up, says waiting and disappears. How can I get around it and not get lost on these crazy roads?

    I recently purchased a second hand new macbook air, although it was second hand to me the previous owner had never actually turned it on.
    Something doesn't make sense here, though I'm not saying the previous owner is lying....
    Time to send your serial # to iTS and let them see what's happening here.
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

  • "waiting" and "system error" status cannot be resent in rwb?

    Hi,gurus:
    In RWB->MESSAGE MONITORING,I can't resend or cancel the messages with the status " waiting" and "system error".
    when I clicked "resend" button,it asked for user and password.After I was authentificated,the system didn't resend a message. Have you ever met this issue?
    By the way,I could resend the error messages before.
    Thanks in advance.

    Hi,
    I checked the note 1233918,and it talked about the same issue.
    But the solution is as follows,which I don't know what to do.(Our PI version is PI7.0 SR3 SP14)
    Symptom
    When the first message for a managed system is cancelled or resent, after pressing ok in the logon pop-up nothing happens - message is not resent or cancelled. The logon data is correct, since subsequent resend/ cancel works without further logon request. Another symptom is cancelling or resending a wrong message, when using the filter mechanism in the table. E.g. the table displays messages A, B, C, D. If message C is selected and after that the filter is set so that message C is hidden from the filter selection, when selecting message D and trying to resend/cancel it, message C is cancelled/resent (the hidden one, previously selected) and nothing is happening with message D.
    Other terms
    NWA, PI, Message monitoring, resend, cancel
    Reason and Prerequisites
    The UI Proxy connection was not obtained properly. Another reason - TableAccessories was not invalidating the nodes properly. Also after filtering the result list, resend/cancel was taking wrong message Ids.
    Solution
    For SP5 install LMNWABASICCOMP05P_1.SCA or higher patch level.
    For SP6 install LMNWABASICCOMP06P_1.SCA or higher patch level.

  • My screen load times have slowed down to a crawl. I have to wait and wait for a page to load. (I know --dial -up) It used to be much faster a month ago before 5.0. Is it FireFox or do I look to Yahoo for the problem? I don't know how to sort it out.

    I use dial-up, FireFox 5.0, Yahoo addition 1.8. My screen load times have slowed down to a crawl. I have to wait and wait for a page to load. (I know --dial -up) It used to be much faster a month ago before 5.0. Is it FireFox or do I look to Yahoo for the problem? I don't know how to sort it out. Using Vista

    I'm having the same problem. Dreamweaver is supper slow. Uploading and downloads from the server... any server I use two different servers. It times out all the time. Menus are slow too.
    I'm on a MAC Pro, 6 gigs of ram no issues with anything else. I have talked to Apple they have checked everything for me. They say it's Dreamweaver. I've noticed the Dreamweaver is talking to the FTP even when I'm not doing anything.
    I've tried cleaning out my MAC caches, turning off file check and check out. Still really slow. I've worked with Dreamweaver for 6 years never any issues like this before. 18 seconds to upload a 4 kb file. 11 seconds to download the same file.

  • Default Buffer Pool Busy Waits and Default Buffer Pool Hit Ratio

    Hi experts,
    I am having oracle database with version 11gR2 on windows server 2003 platform.
    I am continuously getting alerts related to "Default Buffer Pool Busy Waits" and "Default Buffer Pool Hit Ratio."
    I have fired some of the queries(which contain view like v$session_wait) to get information of sessions that causing the same issue,but unable to get it.
    Please help me to resolve the same issue.

    Hi - Try this query for Buffer busy wait
    COL class FORM a10
    COL total_waits FORM 9,999,999,999
    COL "WAITS %" FORM 9999999
    COL time_waited FORM 9999999
    COL "TIME %" FORM 9999999
    COL event FORM a24
    COL avg_wait FORM 9999.99
    SELECT a.event event, substr(c.wait_class,1,9) class,
    a.total_waits total_waits, a.time_waited/100 time_waited,
    a.average_wait avg_wait
    -- a.average_wait/100 avg_wait -- displays seconds instead of 100s
    FROM v$system_event a, v$event_name b, v$system_wait_class c
    WHERE a.event_id=b.event_id
    AND b.wait_class#=c.wait_class#
    AND a.time_waited/100 > 0
    AND (event LIKE '%HW%' OR event = 'buffer busy waits')
    -- AND c.wait_class in ('Application','Concurrency','User I/O')
    ORDER BY 1 DESC;

Maybe you are looking for

  • Swf created at one frame rate, plays very slow in Captivate

    Mac Leopard, Flash CS5, Captivate CS5 Demo, all updates applied to the CSS5 Suite I created swf with one frame on the main timeline, all animation is done within a single movieclip on that frame. When published from flash it plays at my desired speed

  • Monthly purchase value,depending on condition type used.

    Can we search for PO,depending on condition type used in the PO.eg. we are using a condition ZENT for entry tax and the requirement is to search the po containing that ZENT condition.In dynamic selection mode there is condition group in purchase orde

  • Projector not recognized in Mac OSX 10.6.7

    Hi, I am using the new Mac OS X 10.6.7 Intel i7 (quad core); I noticed that the Director projector that I created using Director MX 2004 on an earlier computer, is not being recognized on this new computer (when I copied the folder from the External

  • I can't share in iMovie 10?

    I recently downloaded iMovie to my iMac. I successfully created a short 30 sec project video in iMovie 10 but I can't share. The share button is dead

  • Adobe illustrator a cesse de fonctionner

    Bonjour, bonsoir, En esperant posté au bon endroit. Voila j'ai la suite Adobe créative suite 5.5, donc Illustrator cs 5.1, le logiciel démarre bien, je peut me balader dans les différents menu mais lorsque je veut créer un nouveau fichier le logiciel