@Service(value="blProcessManager") public class ProcessManagerImpl extends Object implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, ProcessManager
ProcessManager
Modifier and Type | Class and Description |
---|---|
static class |
ProcessManagerImpl.KeepAliveJob |
Modifier and Type | Field and Description |
---|---|
protected org.springframework.context.event.ApplicationEventMulticaster |
applicationEventMulticaster |
protected org.springframework.context.ApplicationContext |
context |
protected org.broadleafcommerce.profile.core.service.IdGenerationService |
idGenerationService |
protected long |
jobThreadPoolCount |
protected ProcessDao |
processDao |
protected Map<Long,ProcessStatus> |
processes |
protected boolean |
processManagerEnabled |
protected long |
processManagerStatusUpdateIntervalSeconds |
protected org.quartz.Scheduler |
scheduler |
protected org.springframework.transaction.PlatformTransactionManager |
transactionManager |
protected org.broadleafcommerce.common.util.StreamingTransactionCapableUtil |
transUtil |
Constructor and Description |
---|
ProcessManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
dropProcess()
Remove the process from the list of currently active processes on this server.
|
void |
endProcess()
Finish a process when the async thread of execution is complete.
|
Map<Long,ProcessStatus> |
getProcesses()
Return the list of currently active processes on this server.
|
void |
onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) |
void |
pauseProcess()
Remove the process from the list of currently active processes on this server and set the state to true
for isPaused in the database.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setExecution(Long executionId,
String executionType)
Set the information that associates a specific async thread of execution with a ProcessStatus instance.
|
void |
setProgress(long count,
long total)
|
void |
startProcess(String name,
String friendlyName,
String description)
Add a new arbitrary ProcessStatus to the list of currently active processes on this server.
|
void |
startProcess(String name,
String friendlyName,
String description,
Boolean isPaused)
Add a new arbitrary ProcessStatus to the list of currently active processes on this server.
|
void |
startProcess(String name,
String friendlyName,
String description,
String executionType,
Long executionId)
Add a new arbitrary ProcessStatus to the list of currently active processes on this server.
|
void |
startProcess(String name,
String friendlyName,
String description,
String executionType,
Long executionId,
Boolean isPaused)
Add a new arbitrary ProcessStatus to the list of currently active processes on this server.
|
void |
startProcess(SystemEvent event)
Add a new ProcessStatus to the list of currently active processes on this server.
|
void |
stop() |
boolean |
supportsResume(Long processId)
Detects if a ProcessStatus can be resumed.
|
void |
unPauseProcess(Long processId)
Sets the isPaused state to false for the ProcessStatus.
|
protected org.broadleafcommerce.common.util.StreamingTransactionCapableUtil transUtil
protected org.springframework.transaction.PlatformTransactionManager transactionManager
@Value(value="${process.manager.enabled:true}") protected boolean processManagerEnabled
@Value(value="${process.manager.status.update.interval.seconds:5}") protected long processManagerStatusUpdateIntervalSeconds
protected org.broadleafcommerce.profile.core.service.IdGenerationService idGenerationService
protected ProcessDao processDao
protected org.springframework.context.event.ApplicationEventMulticaster applicationEventMulticaster
protected org.springframework.context.ApplicationContext context
protected long jobThreadPoolCount
protected org.quartz.Scheduler scheduler
protected Map<Long,ProcessStatus> processes
public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
onApplicationEvent
in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
@PreDestroy public void stop()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void startProcess(SystemEvent event)
ProcessManager
DatabaseSystemEventNodeImpl
when consuming an event.startProcess
in interface ProcessManager
public void startProcess(String name, String friendlyName, String description)
ProcessManager
startProcess
in interface ProcessManager
public void startProcess(String name, String friendlyName, String description, Boolean isPaused)
ProcessManager
startProcess
in interface ProcessManager
public void startProcess(String name, String friendlyName, String description, String executionType, Long executionId)
ProcessManager
startProcess
in interface ProcessManager
public void startProcess(String name, String friendlyName, String description, String executionType, Long executionId, Boolean isPaused)
ProcessManager
startProcess
in interface ProcessManager
public void endProcess()
ProcessManager
endProcess
in interface ProcessManager
public void pauseProcess()
ProcessManager
ProcessStatus.getLastUpdated()
is no longer updated. Note, this does nothing to actually stop the async thread of execution. Paused processes
are not eligible for abandoned process handling until the ProcessManager.unPauseProcess(Long)
method is called.pauseProcess
in interface ProcessManager
public void dropProcess()
ProcessManager
ProcessStatus.getLastUpdated()
is no longer updated.
Note, this does nothing to actually stop the async thread of execution. Dropped processes
are eligible for abandoned process handling after their age threshold expiration.dropProcess
in interface ProcessManager
public void setProgress(long count, long total)
ProcessManager
setProgress
in interface ProcessManager
public void setExecution(Long executionId, String executionType)
ProcessManager
setExecution
in interface ProcessManager
executionId
- an identifying long id (e.g. the primary key from an entity used in the async thread of execution)executionType
- an identifying tyep value (e.g. the class name from an entity used in the async thread of execution)public void unPauseProcess(Long processId)
ProcessManager
HandleAbandonedProcessEvent
listener for this ProcessStatus.getExecutionType()
will cause the
resumption of execution.unPauseProcess
in interface ProcessManager
public boolean supportsResume(Long processId)
ProcessManager
HandleAbandonedProcessEvent
that supports
the ProcessStatus.getExecutionType()
implement the
HandleAbandonedProcessEventListener
interface.supportsResume
in interface ProcessManager
public Map<Long,ProcessStatus> getProcesses()
ProcessManager
ProcessStatus.getProcessId()
.getProcesses
in interface ProcessManager
Copyright © 2019. All rights reserved.