blob: 9140c4349169f0fedb19249e855db142d3912895 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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 the waitFor tag waiting for multiple threads.
-->
<jelly xmlns="jelly:core" xmlns:threads="jelly:threads">
<threads:thread var="thread1">
<whitespace>
thread1: going to sleep for 1 second
</whitespace>
<threads:sleep for="1000"/>
</threads:thread>
<threads:thread var="thread2">
<whitespace>
thread2: going to sleep for 2 seconds
</whitespace>
<threads:sleep for="2000"/>
</threads:thread>
<!-- results in a FAILURE -->
<threads:thread var="thread3">
<new var="bogus" className="java.lang.System"/>
</threads:thread>
<!-- waits for thread 1 and 2 -->
<threads:thread>
<threads:waitfor thread="${thread1}" status="SUCCESS"/>
<threads:waitfor thread="${thread2}" status="SUCCESS"/>
<whitespace>
thread4: finished waiting for thread1 and thread2
</whitespace>
</threads:thread>
<!-- waits for thread 3 success -->
<threads:thread>
<threads:waitfor thread="${thread1}" status="SUCCESS"/>
<threads:waitfor thread="${thread2}" status="SUCCESS"/>
<threads:waitfor thread="${thread3}" status="SUCCESS"/>
<whitespace>
thread5: finished waiting for thread1 and thread2 and thread3 success
</whitespace>
</threads:thread>
<!-- waits for thread 3 failure -->
<threads:thread>
<threads:waitfor thread="${thread1}" status="SUCCESS"/>
<threads:waitfor thread="${thread2}" status="SUCCESS"/>
<threads:waitfor thread="${thread3}" status="FAILURE"/>
<whitespace>
thread6: finished waiting for thread1 and thread2 and thread3 failure
</whitespace>
</threads:thread>
</jelly>