01: /*
02: * The contents of this file are subject to the Sapient Public License
03: * Version 1.0 (the "License"); you may not use this file except in compliance
04: * with the License. You may obtain a copy of the License at
05: * http://carbon.sf.net/License.html.
06: *
07: * Software distributed under the License is distributed on an "AS IS" basis,
08: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
09: * the specific language governing rights and limitations under the License.
10: *
11: * The Original Code is The Carbon Component Framework.
12: *
13: * The Initial Developer of the Original Code is Sapient Corporation
14: *
15: * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16: */
17:
18: package org.sape.carbon.core.component.test;
19:
20: import org.sape.carbon.core.component.lifecycle.Startable;
21:
22: /**
23: * This component is used in the ComponentKeeperTest. The component that
24: * uses this class as its functional implementation is
25: * <code>ComponentKeeperTest.LONG_START_COMPONENT</code>. The purpose
26: * of this component is to take a long time to start.
27: *
28: * Copyright 2002 Sapient
29: * @see org.sape.carbon.core.component.test.ComponentKeeperTest
30: * @since carbon 1.0
31: * @author Douglas Voet, Febuary 2002
32: * @version $Revision: 1.9 $($Author: dvoet $ / $Date: 2003/05/05 21:21:15 $)
33: */
34: public class LongStartComponentImpl implements LongStartComponent,
35: Startable {
36:
37: /**
38: * Start the component. On return, the container will begin fowarding
39: * requests to the component. This may be an opportunity to dispatch
40: * worker threads.
41: * <p>
42: * This implementation notifies the test harness that is waiting on
43: * ComponentKeeperTest.TEST_LOCK that it has enterred its startup
44: * method, then procedes to wait on ComponentKeeperTest.TEST_LOCK until
45: * notifed by the test harness
46: *
47: * @throws LifecycleException
48: */
49: public void start() throws InterruptedException {
50: Thread.sleep(2000);
51: // synchronized(ComponentKeeperTest.TEST_LOCK) {
52: // ComponentKeeperTest.TEST_LOCK.notifyAll();
53: // ComponentKeeperTest.TEST_LOCK.wait();
54: // }
55: }
56:
57: /**
58: * Stop the component. Prior to entry, the container will cease forwarding
59: * requests for service to the component. This is an opportunity to cleanly
60: * complete or abort any outstanding work. For example, a set of worker
61: * threads could be killed off, or a queue set to drain.
62: *
63: * @throws LifecycleException
64: */
65: public void stop() {
66: }
67:
68: }
|