|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
StartupImpl.java | 100% | 100% | 100% | 100% |
|
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.hivemind.impl; | |
16 | ||
17 | import java.util.Iterator; | |
18 | import java.util.List; | |
19 | ||
20 | /** | |
21 | * Startup service for the HiveMind Registry. This service is invoked as the | |
22 | * {@link org.apache.hivemind.internal.RegistryInfrastructure#startup() last step} of the | |
23 | * {@link org.apache.hivemind.impl.RegistryBuilder#constructRegistry(Locale) registry construction}. | |
24 | * All contributions (java.lang.Runnable objects) to the <code>hivemind.Startup</code> | |
25 | * configuration point are executed serially in an arbitrary order. Note that the contributions are | |
26 | * <em>not</em> executed in separate Threads. | |
27 | * <p> | |
28 | * HiveMind contributes the <code>hivemind.EagerLoad</code> (see | |
29 | * {@link org.apache.hivemind.service.impl.EagerLoader}) service to the | |
30 | * <code>hivemind.Startup</code> configuration. | |
31 | * | |
32 | * @author Howard Lewis Ship | |
33 | */ | |
34 | public class StartupImpl extends BaseLocatable implements Runnable | |
35 | { | |
36 | private List _runnables; | |
37 | ||
38 | 123 | public void run() |
39 | { | |
40 | 123 | Iterator i = _runnables.iterator(); |
41 | 123 | while (i.hasNext()) |
42 | { | |
43 | 124 | Runnable r = (Runnable) i.next(); |
44 | ||
45 | 124 | r.run(); |
46 | } | |
47 | } | |
48 | ||
49 | 123 | public void setRunnables(List list) |
50 | { | |
51 | 123 | _runnables = list; |
52 | } | |
53 | ||
54 | } |
|