Only wait for a specific condition for 10 seconds?

I have a thread that waits to get notified by another thread. But this thread might crash and therfore never notifiy the waiting thread.
Is it possible for a thread to wait for a notification for only 10 seconds?

You're invoking wait(), right? Look at the API documentation, and you'll easily see other flavors of that method which allow you to specify timeouts.
Make the API documentation part of your toolset.
http://java.sun.com/j2se/1.5.0/docs/api/index.html
That said, I'd first concentrate on fixing the thread code which you say "might crash". Anything else you do to work around that is just a dirty band-aid approach.

Similar Messages

  • Wait for 30 seconds to execute the two functions

    Dear Sir
    I have a package in which two functions are written.Once the first function is executed I wanted the second function to wait for 30 seconds to execute the second functions.Could you please tell me how can I do it?
    Regards

    Go to $ORACLE_HOME/rdbms/admin and read the header:
      --  DESCRIPTION
      --    These routines allow the user to request, convert and release locks.Granting privileges on USER_LOCK is, at least according to the docs I've read, intended to limit the amount of damage a user with execute privs can do.
    You can, of course, find SLEEP in four different Oracle packages:
    * dbms_backup_restore
    * dbms_drs
    * dbms_lock
    * user_lock -- note the granularity is different from dbms_lock and the othersI have documented all of them here:
    http://www.morganslibrary.org/reference/sleep.html
    I think people point those that ask questions to DBMS_LOCK only because it is the one best known.

  • When i go to 'New Folder' the name box only opens for a second so I dont have time to name it correctly. Rename Folder does the same thing - any thoughts??

    when i go to 'New Folder' in outlook the name box only opens for a second so I don't have time to name it correctly. Rename Folder does the same thing. Any thoughts? Many thanks.

    Hi Clint,
    Did you get a reply from anyone for this problem?  I'm having the same problem and wondering what the resolution might be.
    Thanks

  • Can't import songs and ones in library only play for 45 seconds

    I'm in the process of moving my music collection to a new computer with a bigger hard drive. I installed the latest version of iTunes on the new computer, copied all the folders and contents of the itunes folder to the new computer in the same location.
    I bought a couple new songs successfully but now I can't add any of the files from my previous computer to the new library. I was able to import a few songs that iI purchased when on my original machine but now they only play for 45 seconds and jump to the next song in the playlist (if check) And now when I drag and drop songs on the Library to import them absolutely nothing happens.
    And yes, the new computer is authorized and the permissions on the folders are read / write.
    Any one have an idea of how to fix this? If not, I just going to burn all my songs to CD and import them that way and say so long to iTunes... just too much BS to just move a music library!

    Sounds like the PC's authroization file is messed up, or else the iTUnes preferences files.
    Follow the directions in this article, the SC Info file holds the PC authroization for iTMS songs.
    iTunes Does Not Open After Upgrading
    And also deleted these 2 preferecnes files:
    C:\Documents and Settings\username\Application Data\Apple Computer\iTunes\iTunes.pref
    C:\Documents and Settings\username\Local Settings\Application Data\Apple Computer\iTunes\iTunes.pref
    They will all get rebuilt when you open iTunes the next time. It should ask for authorization one last time, is all.
    Message was edited by: Katrina S.

  • COMMIT WORK and WAIT FOR n SECONDS

    I am designing a WebDynpro Java application.  It makes an update call followed immediately by a display call which should return the data that was just updated.  However, it appears that there is some DB latency involved and the data takes a few seconds to update.  The application displays old data if the display call is performed too quickly after the update call.
    All suggestions I could find point to having a Thread sleep on the Java side for a few seconds or have a WAIT FOR n SECONDS and/or COMMIT WORK AND WAIT statement in the ABAP function module.  Neither of these solutions is acceptable in a company-wide application where database latency could vary significantly based on traffic.
    I tried all kinds of functions (i.e. BAPI_TRANSACTION_COMMIT) as well as various forms of COMMIT WORK... nothing except a WAIT works correctly.  There must be a statement out there that waits for the database write to be complete!  How is this solved without picking an arbitrary WAIT time?  What am I missing?
    Thanks in advance!

    You can write the other way.
    declare one variable
    data : wa_try type i.
    wa_try = 10. -> set as 10 ,even you do not get value ,keep on incresing.
    after BAPI FM
    you can call comitt fm.
    after BAPI_TRANSACTION_COMITT
    just use simple logic.
    do wa_try.
    select * from table into table
                                  where record = bapi fm record ( You get in RET2 Message).
    if sy-subrc eq 0.
    exit.
    endif.
    Thanks
    Seshu

  • HT1567 trying to preview song but only plays for 5 seconds

    When i preview a song it will only play for 5 seconds instead of the 1min/half it allows. I 've never had this problem before. I update the software, but it still will not allow me to listen to the song no more tham 5 seconds

    I have had this problem for quite awhile.  Sometimes the preview plays all the way through, or not.  I had it in the previous version and now the new version.  There is no help from Apple/iTunes.  It seems odd that WE must continue to try and find the solution to THEIR errors without any comments or help from Apple. 

  • Music only plays for 15 seconds and then goes to another song

    I upgraded to ios 6. Since then, my old songs only play for 15 seconds. Anything purchased after the upgrade, plays the whole song.  Anyone ????

    Sure your gone for the day, but no luck. Still get 15 sec and then on to the next song.

  • All my songs in my itunes only play for 5 seconds then goes to the next song. what is wrong and can i fix it?

    please someone help me. All my songs in my itunes will only play for 5 seconds the go to the next song. What is wrong and how to i fix it?

    ok so i just figured out that only the songs that i put on a usb drive to transfer them from my other computer are only playing for the 5 secounds so how do i fix that?

  • Many of the songs in my library only play for 53 seconds. Why?

    many of the songs in my music library will only play for 53 seconds. hoe can i fix this?

    ok so i just figured out that only the songs that i put on a usb drive to transfer them from my other computer are only playing for the 5 secounds so how do i fix that?

  • My songs only play for 6 seconds

    My imported music is only playing for six seconds then going to the next track. All of my purchased music works fine though.  The imported files also play in their entirety on Windows Media Player so I know it's not the files' fault. Any suggestions?

    Sure your gone for the day, but no luck. Still get 15 sec and then on to the next song.

  • "CJS-30199 The CTC classes were not found after waiting for 900 seconds."

    Here's the snippet of the sapinst_dev.log
    I am trying to install Central Instance on a RedHat Enterprise 4 server (32bit). But stuck at
    this stage.
    TRACE      [iaxxejsexp.cpp:188]
               EJS_Installer::writeTraceToLogBook()
    2007-05-10 20:19:48.093 FSPath(/usr/sap/LN1/DVEBMGS02/j2ee/cluster/server0/apps/sap.com/tclmctcutilbasic_ear/servlet_jsp/ctc/root/WEB-INF/classes/com/sap/ctc/util/ConfigMainExt.class).isExisting() done: false
    TRACE      [iaxxejsexp.cpp:188]
               EJS_Installer::writeTraceToLogBook()
    2007-05-10 20:19:48.093 NWJavaInstance._waitForFile() - elapsed time = 910 timeout = 900
    TRACE      [iaxxejsexp.cpp:188]
               EJS_Installer::writeTraceToLogBook()
    NWException thrown: nw.usageTypes.ctcSyncWaitTimeout:
    The CTC classes were not found after waiting for 900 seconds.
    ERROR      2007-05-10 20:19:48
               CJSlibModule::writeError_impl()
    CJS-30199  The CTC classes were not found after waiting for 900 seconds.
    TRACE      [iaxxejsbas.hpp:460]
               EJS_Base::dispatchFunctionCall()
    JS Callback has thrown unknown exception. Rethrowing.
    ERROR      2007-05-10 20:19:48 [iaxxgenimp.cpp:736]
               showDialog()
    FCO-00011  The step configCAF with step key |NW_Doublestack_CI|ind|ind|ind|ind|0|0|SAP_Software_Features_Configuration|ind|ind|ind|ind|15|0|NW_Usage_Types_Configuration_AS|ind|ind|ind|ind|0|0|NW_CONFIG_CAF|ind|ind|ind|ind|1|0|configCAF was executed with status ERROR .
    Your help is much appreciated.
    Thanks and Regards,
    Satish/

    Hello Satish
    Please do following checklist:
    1. Check that the J2EE engine is up and running (e.g. log in with Admin)
    2. Check that the following application is running:
         Visual Admin => Cluster => Server => Services => Deploy
         Select "Application" and look for "sap.com/tclmctcutilbasic_ear
    3. Try to continue installation
    It could be helpful to apply the patch for CTC as per note # 938261
    before restarting.
    and also try to add more memory allocation.
    If issue persists,
    - I'd like to know which installation DVD/CD number being using ?
    - The contents of the LABEL.ASC file.
    - The installation guide reference and title used for this install ?
    - SAPINST version ?
    - Oracle version/patch level ?
    - Operating system version/patch level ?
    See also:
    Note # 851251 - SAP NetWeaver 2004s Installation on UNIX
    Thanks
    Kenny

  • I bought an album on iTunes and 3 of the songs only play for 30 seconds. I have tried re-downloading the album 3 times and the problem has not been fixed. I would like some help please and thank you.

    I bought an album on iTunes and 3 of the songs only play for 30 seconds. I have tried re-downloading the album 3 times and the problem has not been fixed. I would like some help please and thank you.
    Artist: Imagine Dragons
    Album: Night Vision

    Report it here:
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

  • Songs only play for 30 seconds

    My CD Imports are only playing for 35 seconds before jumping to the next song.  How do I turn Off the preview function?
    Frustrating!!

    Report it here:
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

  • When I click on "bookmarks" the list only appears for a second or two before disappearing

    When I click on "Bookmarks" my list of saved bookmarks only appears for a second or two before disappearing. I don't have time to make a selection????

    Do you have that problem when running in the Firefox SafeMode?
    [http://support.mozilla.com/en-US/kb/Safe+Mode]
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this:
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • Video only playing for 1 second

    I tried to watch a converted video & it only played for 1 second & went back to select screen. It says it's longer than one second by it only plays for one second.
    Can anybody help?

    >50 still images
    Also read Photo Scaling for Video http://forums.adobe.com/thread/450798
    -Too Large May = Crash http://forums.adobe.com/thread/879967
    -And another crash report http://forums.adobe.com/thread/973935

  • Why do I get a black screen telling me to wait for 40 seconds and then to 'skip ad'?

    I installed a Firefox update and since then, when I try to connect to a website, I almost always get a black screen telling me to wait for 40 seconds and then to 'skip ad'. This is very irritating and a waste of time. There are no ads to skip. Why is this happening and how can I stop it?

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    You can check the connection settings.
    *Firefox > Preferences > Advanced > Network : Connection > Settings
    *https://support.mozilla.org/kb/Options+window+-+Advanced+panel
    If you do not need to use a proxy to connect to internet then try to select "No Proxy" if "Use the system proxy settings" or one of the others do not work properly.
    See "Firefox connection settings":
    *https://support.mozilla.org/kb/Firefox+cannot+load+websites+but+other+programs+can

Maybe you are looking for

  • TEXT.IO in Oracle 10g Forms

    Is TEXT.IO function applicable to Oracle 10g Forms? Is there any other way to upload text files to a database table using Oracle 10g Forms? the procedure is that the user should be able to select text file from his station and upload the contents to

  • Midi physical input - Port Order FYI

    An obscure tid-bit for those of you who have made custom environments or controller assignments, and then added a new midi device only to find that the port order is changed on the physical input object within Logic's environment, and you have to rea

  • Linking HR transactions in portal

    hi we have a situation that a link to be sent to lotus notes while a workflow is initiated by an user to the approving authorities. this link should be able take the approver/user directly to the portal and should be able to execute the transaction d

  • ITunes freezes when trying to determine gapless playback on Ipod.

    Hi, I have quite a problem and I hope someone can help me out here. Ever since updating to the latest iTunes, I've been experiencing problems with syncing it with my iPod. I manage my files manually. When copying files to my ipod, the files seem to t

  • ATV2 + iPhone 4 + MacBook Pro + Airport Express

    Hi, I have ATV2, an iPhone 4 (iOS 4.2.1), a MacBook Pro and Airport Express. I have no internet access (dsl or the like) at home. How can I connect my iPhone 4 to ATV2 and stream videos etc. using Air Play? Do I have to set up a home network first (u