AutoDeployScanner.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.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(ThreadGroup group, String name, 26 AutoDeployDir dir) { 27 28 super(group, name); 29 30 _dir = dir; 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(_dir.getInterval()); 47 } 48 catch (InterruptedException ie) { 49 } 50 51 _dir.scanDirectory(); 52 } 53 } 54 55 public void pause() { 56 _started = false; 57 } 58 59 private AutoDeployDir _dir; 60 private boolean _started = true; 61 62 }