ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject RE: Wildcards in the file attribute for the available task
Date Wed, 10 Jul 2002 23:29:12 GMT
I couldn't think of any way to do it other than using <script>, along with
<parallel> and <waitfor>. (Well, I suppose you could 86 the <parallel> and
<waitfor> and just have the script do the timeout, but it gave me a good
excuse to play with them, and besides, it's less script code this way).

  <target name="waitforit">
    <property name="msgdir" location="jbossmq"/>
      <waitfor maxwait="10" maxwaitunit="second" timeoutproperty="stuck">
        <isset property="all.gone"/>
      <script language="javascript"> <![CDATA[
        dir = new"msgdir")) ;
        for( ;; ) {
          if( dir.list().length == 0 ) {
            project.setNewProperty("all.gone", "true");
          } else {
            if( project.getProperty("stuck") != null ) { break ; }
          java.lang.Thread.sleep(5000); // give it a rest :)
    <fail unless="all.gone" message="Messages are stuck in the queue!"/>
    <echo>All gone!</echo>

Of course, you'll want to up your "maxwaitunit" -- I just didn't feel like
sitting around for 10 minutes waiting to see if it worked :)

Also, it does rely on the idea that no files other than queued message
files live in that directory -- if that's not really guaranteed, you'll
need to beef it up to list only the pertinent files.



Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message