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 Loggerloggercreate a static logger.protected booleanneedRunningstatic org.javlo.thread.AbstractThread.ThreadFileFilterthreadFileFilter
-
Constructor Summary
Constructors Constructor Description AbstractThread()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static AbstractThreadcreateInstance(String threadFolder, Class<? extends AbstractThread> clazz)voiddestroy()destroy the thread, this method can be override for not delete the file after run the process (recurent process)StringgetField(String key)static StringgetFileName(String id)StringgetId()static AbstractThreadgetInstance(File file)NotificationServicegetNotificationService()longgetTimeout()get the timeout, after this time thread is killed by thread manager.StringlogInfo()info for display in log.booleanneedRunning()abstract voidrun()voidsetField(String key, String value)voidsetId(String id)voidsetNotificationService(NotificationService notificationService)voidstore()
-
-
-
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)
-
-