public abstract class DeployController<I extends DeployInstance> extends java.lang.Object implements DeployControllerApi<I>, Dependency, DeployActionHandler
Modifier and Type | Field and Description |
---|---|
protected Lifecycle |
_lifecycle |
static long |
REDEPLOY_CHECK_INTERVAL |
Modifier | Constructor and Description |
---|---|
protected |
DeployController(java.lang.String id) |
protected |
DeployController(java.lang.String id,
java.lang.ClassLoader parentLoader) |
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(LifecycleListener listener)
External lifecycle listeners, so applications can detect deployment
and redeployment.
|
void |
alarm()
Internal notification for modification updates, either from a timer
or a repository notification.
|
void |
close()
Closes the controller
|
protected void |
configureInstance(I deployInstance)
Configuration of the instance
|
protected boolean |
controllerLogModified(java.util.logging.Logger log) |
protected I |
createDeployInstance()
Returns the current instance.
|
protected boolean |
destroy()
Destroys the entry.
|
protected void |
destroyInstance(I instance) |
I |
getActiveDeployInstance()
Returns the current instance, waiting for active.
|
long |
getActiveWaitTime() |
DeployControllerType |
getControllerType()
Returns the controller type
|
I |
getDeployInstance()
Returns the current instance.
|
I |
getDeployInstanceImpl()
Returns the current instance.
|
java.lang.String |
getId()
Returns the controller's id.
|
java.lang.String |
getIdKey() |
java.lang.String |
getIdStage() |
java.lang.String |
getIdType() |
protected java.util.logging.Logger |
getLog()
Returns the appropriate log for debugging.
|
java.lang.ClassLoader |
getParentClassLoader()
Returns the parent class loader.
|
long |
getRedeployCheckInterval()
Gets the redeploy-check-interval
|
DeployMode |
getRedeployMode()
Returns the redeploy mode.
|
long |
getStartTime()
Returns the start time of the entry.
|
DeployMode |
getStartupMode()
Returns the startup mode.
|
int |
getStartupPriority()
Gets the startup priority.
|
LifecycleState |
getState()
Returns the state name.
|
boolean |
init()
Initialize the entry.
|
protected void |
initBegin()
Initial calls for init.
|
protected void |
initEnd()
Final calls for init.
|
protected abstract I |
instantiateDeployInstance()
Creates an instance.
|
protected boolean |
isControllerModified() |
protected boolean |
isControllerModifiedNow() |
boolean |
isIdleTimeout()
Returns true if the instance has been idle for longer than its timeout.
|
boolean |
isModified()
Returns true if the entry is modified.
|
boolean |
isModifiedNow()
Returns true if the entry is modified.
|
boolean |
isNameMatch(java.lang.String name)
Returns true if
|
boolean |
logModified(java.util.logging.Logger log)
Log the reason for modification
|
void |
merge(DeployControllerApi<I> newController)
Merges with the new controller information
|
void |
mergeRedeployCheckInterval(long interval)
Sets the redeploy-check-interval
|
void |
mergeRedeployMode(DeployMode mode)
Merge the redeploy mode.
|
protected void |
onActive() |
protected void |
onDestroy() |
protected void |
onError(java.lang.Throwable e) |
protected void |
onRemove() |
protected void |
onStartComplete() |
protected void |
onStop() |
protected void |
postConfigureInstance(I deployInstance)
After instance configuration
|
protected void |
preConfigureInstance(I deployInstance)
Before instance configuration
|
void |
remove()
Remove the controller
|
I |
request()
Returns the instance for a top-level request
|
void |
restart()
Force an instance restart from an admin command.
|
void |
setActiveWaitTimeMillis(long wait)
Sets the delay time waiting for a restart
|
void |
setControllerType(DeployControllerType type) |
void |
setRedeployCheckInterval(Period period)
Sets the redeploy-check-interval
|
void |
setRedeployMode(DeployMode mode)
Sets the redeploy mode.
|
void |
setStartupMode(DeployMode mode)
Sets the startup mode.
|
void |
setStartupPriority(int priority)
Sets the startup priority.
|
void |
start()
Force an instance start from an admin command.
|
protected I |
startImpl()
Starts the entry.
|
void |
startOnInit()
Starts the entry on initialization
|
void |
stop()
Stops the controller from an admin command.
|
protected void |
stopImpl()
Stops the current instance.
|
protected void |
stopLazyImpl()
Stops the current instance, putting it in the lazy state.
|
I |
subrequest()
Returns the instance for a subrequest.
|
void |
toRestart() |
void |
toStart() |
void |
toStop() |
java.lang.String |
toString()
Returns the entry's debug name.
|
void |
update()
Update the controller from an admin command.
|
public static final long REDEPLOY_CHECK_INTERVAL
protected final Lifecycle _lifecycle
protected DeployController(java.lang.String id)
protected DeployController(java.lang.String id, java.lang.ClassLoader parentLoader)
protected abstract I instantiateDeployInstance()
public final java.lang.String getId()
getId
in interface DeployControllerApi<I extends DeployInstance>
public final java.lang.String getIdStage()
public final java.lang.String getIdType()
public final java.lang.String getIdKey()
public java.lang.ClassLoader getParentClassLoader()
public DeployControllerType getControllerType()
DeployControllerApi
getControllerType
in interface DeployControllerApi<I extends DeployInstance>
public void setControllerType(DeployControllerType type)
public void setStartupMode(DeployMode mode)
public void setStartupPriority(int priority)
public int getStartupPriority()
getStartupPriority
in interface DeployControllerApi<I extends DeployInstance>
public void merge(DeployControllerApi<I> newController)
merge
in interface DeployControllerApi<I extends DeployInstance>
public DeployMode getStartupMode()
public void setRedeployMode(DeployMode mode)
public void mergeRedeployMode(DeployMode mode)
public DeployMode getRedeployMode()
public void mergeRedeployCheckInterval(long interval)
public void setRedeployCheckInterval(Period period)
public long getRedeployCheckInterval()
public void setActiveWaitTimeMillis(long wait)
public long getActiveWaitTime()
public boolean isNameMatch(java.lang.String name)
isNameMatch
in interface DeployControllerApi<I extends DeployInstance>
public final long getStartTime()
public final boolean init()
init
in interface DeployControllerApi<I extends DeployInstance>
protected void initBegin()
protected void initEnd()
public final LifecycleState getState()
getState
in interface DeployControllerApi<I extends DeployInstance>
public final boolean isIdleTimeout()
public boolean isModified()
isModified
in interface Dependency
public boolean isModifiedNow()
public final boolean logModified(java.util.logging.Logger log)
logModified
in interface Dependency
protected boolean isControllerModified()
protected boolean isControllerModifiedNow()
protected boolean controllerLogModified(java.util.logging.Logger log)
public I getDeployInstance()
getDeployInstance
in interface DeployControllerApi<I extends DeployInstance>
public I getActiveDeployInstance()
DeployControllerApi
getActiveDeployInstance
in interface DeployControllerApi<I extends DeployInstance>
public I getDeployInstanceImpl()
protected final I createDeployInstance()
public void addLifecycleListener(LifecycleListener listener)
DeployControllerApi
addLifecycleListener
in interface DeployControllerApi<I extends DeployInstance>
public void startOnInit()
startOnInit
in interface DeployControllerApi<I extends DeployInstance>
public final void start()
start
in interface DeployControllerApi<I extends DeployInstance>
public final void stop()
stop
in interface DeployControllerApi<I extends DeployInstance>
public final void restart()
restart
in interface DeployControllerApi<I extends DeployInstance>
public final void update()
update
in interface DeployControllerApi<I extends DeployInstance>
public final I request()
request
in interface DeployControllerApi<I extends DeployInstance>
public final I subrequest()
subrequest
in interface DeployControllerApi<I extends DeployInstance>
protected I startImpl()
protected void stopLazyImpl()
protected void stopImpl()
protected void destroyInstance(I instance)
protected void onActive()
protected void onError(java.lang.Throwable e)
protected void onStartComplete()
protected void onStop()
protected void preConfigureInstance(I deployInstance) throws java.lang.Exception
java.lang.Exception
protected void configureInstance(I deployInstance) throws java.lang.Exception
java.lang.Exception
protected void postConfigureInstance(I deployInstance) throws java.lang.Exception
java.lang.Exception
public void toStart()
toStart
in interface DeployActionHandler
public void toStop()
toStop
in interface DeployActionHandler
public void toRestart()
toRestart
in interface DeployActionHandler
public final void alarm()
DeployControllerApi
alarm
in interface DeployControllerApi<I extends DeployInstance>
public final void close()
DeployControllerApi
close
in interface DeployControllerApi<I extends DeployInstance>
public final void remove()
DeployControllerApi
remove
in interface DeployControllerApi<I extends DeployInstance>
protected boolean destroy()
protected void onDestroy()
protected void onRemove()
protected java.util.logging.Logger getLog()
public java.lang.String toString()
toString
in class java.lang.Object