|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.mmm.util.component.base.AbstractComponent
net.sf.mmm.util.component.base.AbstractLoggableComponent
net.sf.mmm.util.component.impl.PeriodicRefresherImpl
@Singleton @Named public class PeriodicRefresherImpl
This is the implementation of PeriodicRefresher
.
Field Summary | |
---|---|
private boolean |
active
|
private static int |
DEFAULT_REFRESH_DELAY_IN_SECONDS
The default refresh-delay . |
private Executor |
executor
|
private static Integer |
MIN_DELAY
The minimum value allowed for refreshDelayInSeconds . |
private Set<Refreshable> |
refreshableSet
The Set of Refreshable s. |
private int |
refreshDelayInSeconds
|
private Thread |
refreshThread
|
private boolean |
shutdown
|
Constructor Summary | |
---|---|
PeriodicRefresherImpl()
The constructor. |
Method Summary | |
---|---|
void |
addRefreshable(Refreshable refreshable)
This method will register the given refreshable so it will be
refreshed periodically. |
void |
close()
|
protected void |
doInitialize()
This method performs the actual initialization . |
protected Executor |
getExecutor()
|
int |
getRefreshDelaySeconds()
|
protected String |
getThreadName()
This method gets the thread-name. |
void |
removeRefreshable(Refreshable refreshable)
This method removes the given refreshable from this
PeriodicRefresher . |
void |
run()
|
void |
setExecutor(Executor executor)
|
void |
setRefreshDelayInSeconds(int refreshDelayInSeconds)
This method sets the refresh-delay in seconds. |
void |
startup()
This method will initialize and startup this refresher. |
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent |
---|
getLogger, setLogger |
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent |
---|
doInitialized, getInitializationState, initialize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int DEFAULT_REFRESH_DELAY_IN_SECONDS
refresh-delay
.
private static final Integer MIN_DELAY
refreshDelayInSeconds
.
private Executor executor
getExecutor()
private int refreshDelayInSeconds
getRefreshDelaySeconds()
private boolean active
startup()
private volatile boolean shutdown
close()
private Set<Refreshable> refreshableSet
Set
of Refreshable
s.
private Thread refreshThread
close()
Constructor Detail |
---|
public PeriodicRefresherImpl()
Method Detail |
---|
protected void doInitialize()
initialization
. It is
called when AbstractComponent.initialize()
is invoked for the first time.super.AbstractComponent.doInitialize()
.
doInitialize
in class AbstractLoggableComponent
public void startup()
closed
.AbstractComponent.initialize()
so
the startup only happens if explicitly required and not accidently because
this component if found and managed by some container.
public void addRefreshable(Refreshable refreshable)
refreshable
so it will be
refreshed
periodically.Refreshable
is added here.Refreshable
if this is really desired and its implementation of
Refreshable.refresh()
is fast or only takes performance if
something that rarely changes has been modified.Refreshable
has to have a proper implementation
of Object.equals(Object)
and Object.hashCode()
as it may be
stored in a Collection
.
addRefreshable
in interface PeriodicRefresher
refreshable
- is the Refreshable
to register and refresh
periodically.public void removeRefreshable(Refreshable refreshable)
refreshable
from this
PeriodicRefresher
. This will typically happen when the according
Refreshable
shall be closed
or
disposed.searchEngine
has never been
registered
, this method has no effect.
removeRefreshable
in interface PeriodicRefresher
refreshable
- is the Refreshable
to de-register.@PreDestroy public void close()
close
in interface Closeable
protected String getThreadName()
public void run()
run
in interface Runnable
protected Executor getExecutor()
@Inject public void setExecutor(Executor executor)
executor
- is the executor to setpublic int getRefreshDelaySeconds()
public void setRefreshDelayInSeconds(int refreshDelayInSeconds)
refreshDelayInSeconds
- is the refreshDelayInSeconds to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |