| AutoDeployScanner.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * The contents of this file are subject to the terms of the Liferay Enterprise
5 * Subscription License ("License"). You may not use this file except in
6 * compliance with the License. You can obtain a copy of the License by
7 * contacting Liferay, Inc. See the License for the specific language governing
8 * permissions and limitations under the License, including but not limited to
9 * distribution rights of the Software.
10 *
11 *
12 *
13 */
14
15 package com.liferay.portal.kernel.deploy.auto;
16
17 /**
18 * <a href="AutoDeployScanner.java.html"><b><i>View Source</i></b></a>
19 *
20 * @author Ivica Cardic
21 * @author Brian Wing Shun Chan
22 */
23 public class AutoDeployScanner extends Thread {
24
25 public AutoDeployScanner(
26 ThreadGroup threadGroup, String name, AutoDeployDir autoDeployDir) {
27
28 super(threadGroup, name);
29
30 _autoDeployDir = autoDeployDir;
31
32 setContextClassLoader(getClass().getClassLoader());
33 setDaemon(true);
34 setPriority(MIN_PRIORITY);
35 }
36
37 public void run() {
38 try {
39 sleep(1000 * 10);
40 }
41 catch (InterruptedException ie) {
42 }
43
44 while (_started) {
45 try {
46 sleep(_autoDeployDir.getInterval());
47 }
48 catch (InterruptedException ie) {
49 }
50
51 _autoDeployDir.scanDirectory();
52 }
53 }
54
55 public void pause() {
56 _started = false;
57 }
58
59 private AutoDeployDir _autoDeployDir;
60 private boolean _started = true;
61
62 }