blob: b944ca8ce801775342672cff13dbc5f0bf2c227f [file] [log] [blame]
<?xml version="1.0"?>
<!--
Copyright 2002-2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This test shows how the waitFor tag works.
-->
<jelly xmlns="jelly:core" xmlns:threads="jelly:threads">
<threads:thread var="thread1">
<whitespace>
thread1: going to sleep for 2 seconds
</whitespace>
<threads:sleep for="2000"/>
</threads:thread>
<threads:thread var="thread2">
<whitespace>
thread2: waiting for thread1 for 1 second
</whitespace>
<!-- this thread will be marked as avoided -->
<threads:waitfor thread="${thread1}" onlyWait="1000"/>
<whitespace>
thread2: finished waiting for thread1
</whitespace>
<threads:sleep for="1000"/>
</threads:thread>
<threads:thread>
<!-- wait for thread2's avoided status -->
<threads:waitfor thread="${thread2}" status="AVOIDED"/>
<whitespace>
thread3: finished waiting for thread2 avoided status
</whitespace>
</threads:thread>
<threads:thread var="thread4">
<!-- wait for the thread2's success -->
<threads:waitfor thread="${thread2}" status="SUCCESS"/>
<whitespace>
thread4: finished waiting for thread2 success status
</whitespace>
</threads:thread>
<threads:thread>
<!-- wait for the thread2's success -->
<threads:waitfor thread="${thread4}" status="AVOIDED"/>
<whitespace>
thread6: finished waiting for thread4 avoided status
</whitespace>
</threads:thread>
</jelly>