001 // Copyright 2004, 2005 The Apache Software Foundation
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package org.apache.hivemind.impl;
016
017 import java.util.Iterator;
018 import java.util.List;
019
020 /**
021 * Startup service for the HiveMind Registry. This service is invoked as the
022 * {@link org.apache.hivemind.internal.RegistryInfrastructure#startup() last step} of the
023 * {@link org.apache.hivemind.impl.RegistryBuilder#constructRegistry(java.util.Locale) registry construction}.
024 * All contributions (java.lang.Runnable objects) to the <code>hivemind.Startup</code>
025 * configuration point are executed serially in an arbitrary order. Note that the contributions are
026 * <em>not</em> executed in separate Threads.
027 * <p>
028 * HiveMind contributes the <code>hivemind.EagerLoad</code> (see
029 * {@link org.apache.hivemind.service.impl.EagerLoader}) service to the
030 * <code>hivemind.Startup</code> configuration.
031 *
032 * @author Howard Lewis Ship
033 */
034 public class StartupImpl extends BaseLocatable implements Runnable
035 {
036 private List _runnables;
037
038 public void run()
039 {
040 Iterator i = _runnables.iterator();
041 while (i.hasNext())
042 {
043 Runnable r = (Runnable) i.next();
044
045 r.run();
046 }
047 }
048
049 public void setRunnables(List list)
050 {
051 _runnables = list;
052 }
053
054 }