%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.commons.jelly.tags.quartz.WaitForSchedulerTag |
|
|
1 | package org.apache.commons.jelly.tags.quartz; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2002,2004 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
17 | */ |
|
18 | ||
19 | import org.apache.commons.jelly.XMLOutput; |
|
20 | ||
21 | import org.apache.commons.jelly.JellyTagException; |
|
22 | ||
23 | import org.quartz.Scheduler; |
|
24 | import org.quartz.SchedulerException; |
|
25 | ||
26 | /** Block and wait for the Quartz scheduler to shutdown. |
|
27 | * |
|
28 | * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a> |
|
29 | */ |
|
30 | public class WaitForSchedulerTag extends QuartzTagSupport |
|
31 | { |
|
32 | // ------------------------------------------------------------ |
|
33 | // Constructors |
|
34 | // ------------------------------------------------------------ |
|
35 | ||
36 | /** Construct. |
|
37 | */ |
|
38 | public WaitForSchedulerTag() |
|
39 | 0 | { |
40 | // intentionally left blank. |
|
41 | 0 | } |
42 | ||
43 | // ------------------------------------------------------------ |
|
44 | // Instance methods |
|
45 | // ------------------------------------------------------------ |
|
46 | ||
47 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
48 | // org.apache.commons.jelly.Tag |
|
49 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
50 | ||
51 | /** Perform this tag. |
|
52 | * |
|
53 | * @param output Output sink. |
|
54 | * |
|
55 | * @throws Exception If an error occurs. |
|
56 | */ |
|
57 | public void doTag(XMLOutput output) throws JellyTagException |
|
58 | { |
|
59 | try { |
|
60 | 0 | Scheduler sched = getScheduler(); |
61 | ||
62 | 0 | while ( ! sched.isShutdown() ) |
63 | { |
|
64 | try |
|
65 | { |
|
66 | 0 | Thread.sleep( 500 ); |
67 | 0 | } |
68 | catch (InterruptedException e) |
|
69 | { |
|
70 | 0 | break; |
71 | } |
|
72 | } |
|
73 | 0 | } |
74 | catch (SchedulerException e) { |
|
75 | 0 | throw new JellyTagException(e); |
76 | } |
|
77 | 0 | } |
78 | } |
|
79 |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |