1 /* 2 * Copyright 2006-2009 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.osgi.service.importer.event; 18 19 import org.springframework.osgi.service.importer.OsgiServiceDependency; 20 21 /** 22 * Importer event indicating that the wait for a given dependency has ended 23 * (successfully), namely the dependency was found before the time allocated for 24 * it elapsed. 25 * 26 * @author Costin Leau 27 * 28 */ 29 public class OsgiServiceDependencyWaitEndedEvent extends OsgiServiceDependencyEvent { 30 31 private final long waitedTime; 32 33 34 /** 35 * Constructs a new <code>OsgiServiceDependencyWaitEndedEvent</code> 36 * instance. 37 * 38 * @param source event source (usually the service importer) 39 * @param dependency dependency description 40 * @param elapsedTime time to wait 41 */ 42 public OsgiServiceDependencyWaitEndedEvent(Object source, OsgiServiceDependency dependency, long elapsedTime) { 43 super(source, dependency); 44 this.waitedTime = elapsedTime; 45 } 46 47 /** 48 * Returns the time spent (in milliseconds) waiting, until service was found 49 * (and the dependency considered satisfied). 50 * 51 * @return Returns the time (in milliseconds) spent waiting for the OSGi 52 * service to appear 53 */ 54 public long getElapsedTime() { 55 return waitedTime; 56 } 57 }