| SandboxDeployScanner.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portal.kernel.deploy.sandbox;
16
17 /**
18 * <a href="SandboxDeployScanner.java.html"><b><i>View Source</i></b></a>
19 *
20 * @author Igor Spasic
21 * @author Brian Wing Shun Chan
22 */
23 public class SandboxDeployScanner extends Thread {
24
25 public SandboxDeployScanner(
26 ThreadGroup threadGroup, String name,
27 SandboxDeployDir sandboxDeployDir) {
28
29 super(threadGroup, name);
30
31 _sandboxDeployDir = sandboxDeployDir;
32
33 setContextClassLoader(getClass().getClassLoader());
34 setDaemon(true);
35 setPriority(MIN_PRIORITY);
36 }
37
38 public void run() {
39 try {
40 sleep(1000 * 10);
41 }
42 catch (InterruptedException ie) {
43 }
44
45 while (_started) {
46 try {
47 sleep(_sandboxDeployDir.getInterval());
48 }
49 catch (InterruptedException ie) {
50 }
51
52 _sandboxDeployDir.scanDirectory();
53 }
54 }
55
56 public void pause() {
57 _started = false;
58 }
59
60 private SandboxDeployDir _sandboxDeployDir;
61 private boolean _started = true;
62
63 }