Package org.javlo.thread
Class AbstractThread
- java.lang.Object
-
- org.javlo.thread.AbstractThread
-
- Direct Known Subclasses:
ReadURLThread
,SmartExternalLink.UndateInfo
,SynchronisationThread
,SynchroThread
,ThreadTest
public abstract class AbstractThread extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static Logger
logger
create a static logger.protected boolean
needRunning
static org.javlo.thread.AbstractThread.ThreadFileFilter
threadFileFilter
-
Constructor Summary
Constructors Constructor Description AbstractThread()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static AbstractThread
createInstance(String threadFolder, Class<? extends AbstractThread> clazz)
void
destroy()
destroy the thread, this method can be override for not delete the file after run the process (recurent process)String
getField(String key)
static String
getFileName(String id)
String
getId()
static AbstractThread
getInstance(File file)
NotificationService
getNotificationService()
long
getTimeout()
get the timeout, after this time thread is killed by thread manager.String
logInfo()
info for display in log.boolean
needRunning()
abstract void
run()
void
setField(String key, String value)
void
setId(String id)
void
setNotificationService(NotificationService notificationService)
void
store()
-
-
-
Field Detail
-
logger
protected static Logger logger
create a static logger.
-
needRunning
protected boolean needRunning
-
threadFileFilter
public static final org.javlo.thread.AbstractThread.ThreadFileFilter threadFileFilter
-
-
Method Detail
-
createInstance
public static AbstractThread createInstance(String threadFolder, Class<? extends AbstractThread> clazz) throws InstantiationException, IllegalAccessException
-
getInstance
public static AbstractThread getInstance(File file) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
-
store
public void store() throws IOException
- Throws:
IOException
-
needRunning
public boolean needRunning()
-
destroy
public void destroy()
destroy the thread, this method can be override for not delete the file after run the process (recurent process)
-
logInfo
public String logInfo()
info for display in log.- Returns:
-
getTimeout
public long getTimeout()
get the timeout, after this time thread is killed by thread manager.- Returns:
- timeout in ms
-
run
public abstract void run()
-
getNotificationService
public NotificationService getNotificationService()
-
getId
public String getId()
-
setId
public void setId(String id)
-
setNotificationService
public void setNotificationService(NotificationService notificationService)
-
-