SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Oct 2002
    Location
    Indianapolis,IN,USA
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    sleep method in java class

    This might be more of a java question than an RFT question...but...

    I need to write a method within a java class that will pause script execution until a control becomes enabled. To do so, I created a loop within which I get the property value from the control and break out of the loop when it is equal to that value. My problem is that I only want it to check every 2 seconds. How do I put the equivalent of a call to the 'sleep' method within a java class method? or even better...is there a 'waitforpropertyequals' method that I don't know about?

  2. #2
    Moderator
    Join Date
    Sep 2001
    Location
    Boston, MA
    Posts
    4,348
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: sleep method in java class

    Thread.sleep(1000) would put the current thread to sleep for 1 second (1000 ms). It needs to go within a try/catch block since it throws an exception.

    you can also do event-driven programming

    -Corey
    Corey Goldberg
    Homepage: goldb.org
    Twitter: twitter.com/cgoldberg
    Google+: gplus.to/cgoldberg

  3. #3
    Junior Member
    Join Date
    Jul 2005
    Location
    Chennai
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: sleep method in java class

    the method
    waitForExistence(wait_time,time_intervel) will do the required.

    Here wait_time is maximum wait time.
    time_intervel is check for the objects for every seconds specified.
    Eg:

    table_htmlTable_2().waitForExistence(180,2),
    so it waits upto 3 min and check the object for every 2 seconds.

  4. #4
    Senior Member
    Join Date
    Apr 2003
    Posts
    388
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: sleep method in java class

    waitForExistance would be best but Rational has a sleep method you can use:
    sleep(10); // sleep for ten seconds.

  5. #5
    Junior Member
    Join Date
    May 2008
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: sleep method in java class

    if you are waiting for something dynamic, and it generates in interval 10s to 2 mins, then sleep(120) would be somehow inefective

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.68%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:55 AM.

Copyright BetaSoft Inc.