public class StatusScheduler extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
StatusScheduler.ThreadFactory
GlassFish status tasks scheduler
StatusScheduler.ThreadFactory . |
Modifier and Type | Field and Description |
---|---|
private static int |
CONNECT_TIMEOUT
Administration port connect timeout [ms].
|
private static int |
DEFAULT_INTERNAL_CORE_POOL_SIZE
The number of threads to keep in the pool, even if they are idle.
|
private static long |
DELAY
Tasks execution delay [ms].
|
private ScheduledThreadPoolExecutor |
executor
Executor to run server status checks.
|
private static long |
INITIAL_DELAY
Tasks execution initial delay [ms].
|
private static StatusScheduler |
instance
Singleton object instance.
|
private Map<GlassFishServer,StatusJob> |
jobs
Server status jobs.
|
private static Logger |
LOGGER
Logger instance for this class.
|
private static ScheduledThreadPoolExecutor |
scheduledExecutor
External executor instance.
|
Modifier | Constructor and Description |
---|---|
private |
StatusScheduler(ScheduledThreadPoolExecutor executor)
Creates an instance of server status checks scheduler.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(GlassFishStatusEntity status)
Register GlassFisg server instance into scheduler and launch server
status checking jobs.
|
private boolean |
addJob(StatusJob job)
Add server status job into jobs
Map . |
private void |
allChecksAtOnce(StatusJob job)
All checks at once when we need full result ASAP.
|
private void |
allChecksStepByStep(StatusJob job)
All checks step by step when server state is stable and we have to run
all checks.
|
boolean |
exists(GlassFishServer srv)
Check if given GlassFisg server instance was already registered.
|
GlassFishServerStatus |
get(GlassFishServer srv)
Get GlassFisg server instance status object from scheduler.
|
static StatusScheduler |
getInstance()
Return existing singleton instance of this class or create a new one
when no instance exists.
|
private StatusJob |
getJob(GlassFishServer srv)
Get server status job from jobs
Map . |
static void |
init(ScheduledThreadPoolExecutor executor)
Allows to initialize this class to use external executor.
|
private static ScheduledThreadPoolExecutor |
newScheduledExecutor()
Allows to initialize this class to use internal executor.
|
private void |
portCheckOnly(StatusJob job)
Administrator port only check for states where we do not expect server
to be fully responding.
|
(package private) void |
remove(StatusJob job)
Remove all scheduled tasks from executor.
|
private StatusJob |
removeJob(GlassFishServer srv)
Remove server status job from jobs
Map . |
(package private) void |
reschedule(StatusJob job)
Schedule server status job after internal state transition to follow
current strategy.
|
private ScheduledFuture |
scheduleAdminPortTask(StatusJob job)
Schedule periodic execution of port check asynchronous task.
|
private ScheduledFuture |
scheduleLocationsTask(StatusJob job)
Schedule periodic execution of
__locations
asynchronous task. |
private ScheduledFuture |
scheduleLocationsTask(StatusJob job,
long initialDelay)
Schedule periodic execution of
__locations
asynchronous task. |
(package private) ScheduledFuture |
scheduleNew(StatusJob job)
Schedule new server status job.
|
private ScheduledFuture |
scheduleVersionTask(StatusJob job)
Schedule periodic execution of
version asynchronous task. |
private ScheduledFuture |
scheduleVersionTask(StatusJob job,
long initialDelay)
Schedule periodic execution of
version asynchronous task. |
private static final Logger LOGGER
private static ScheduledThreadPoolExecutor scheduledExecutor
private static volatile StatusScheduler instance
private static final int DEFAULT_INTERNAL_CORE_POOL_SIZE
private static final long DELAY
private static final long INITIAL_DELAY
private static final int CONNECT_TIMEOUT
private ScheduledThreadPoolExecutor executor
private final Map<GlassFishServer,StatusJob> jobs
private StatusScheduler(ScheduledThreadPoolExecutor executor)
executor
- External executor.public static void init(ScheduledThreadPoolExecutor executor)
getInstance()
method.
executor
- External executor to be supplied.private static ScheduledThreadPoolExecutor newScheduledExecutor()
getInstance()
method. Caller should hold StatusScheduler.class
lock.
executor
- External executor to be supplied.public static StatusScheduler getInstance()
GlassFishAccountInstanceProvider
singleton instance.public boolean exists(GlassFishServer srv)
srv
- GlassFisg server instance to be checked.public GlassFishServerStatus get(GlassFishServer srv)
srv
- GlassFisg server instance to search for in jobs.public boolean add(GlassFishStatusEntity status)
private StatusJob getJob(GlassFishServer srv)
Map
.
srv
- GlassFisg server instance to search for in jobs.null
when no such job exists.private boolean addJob(StatusJob job)
Map
.
Server status job will be added only if there is no other job for
GlassFisg server instance associated with this job.
true
when jow was added into jobs
Map
or false
otherwise.private StatusJob removeJob(GlassFishServer srv)
Map
.
srv
- GlassFisg server instance associated with job to be removed.private ScheduledFuture scheduleLocationsTask(StatusJob job, long initialDelay)
__locations
asynchronous task.
job
- Server status check job internal data.initialDelay
- Task execution initial delay.private ScheduledFuture scheduleVersionTask(StatusJob job, long initialDelay)
version
asynchronous task.
job
- Server status check job internal data.initialDelay
- Task execution initial delay.private ScheduledFuture scheduleLocationsTask(StatusJob job)
__locations
asynchronous task.
job
- Server status check job internal data.private ScheduledFuture scheduleVersionTask(StatusJob job)
version
asynchronous task.
job
- Server status check job internal data.private ScheduledFuture scheduleAdminPortTask(StatusJob job)
job
- Server status check job internal data.private void portCheckOnly(StatusJob job)
job
- Server status check job internal data.private void allChecksAtOnce(StatusJob job)
job
- Server status check job internal data.private void allChecksStepByStep(StatusJob job)
job
- Server status check job internal data.void remove(StatusJob job)
ScheduledFuture scheduleNew(StatusJob job)
UNKNOWN
state.
job
- Server status job.void reschedule(StatusJob job)
UNKNOWN
.
job
- Server status job.Copyright © 2013. All Rights Reserved.