@Repository(value="blDatabaseSystemEventDao") public class DatabaseSystemEventDaoImpl extends Object implements DatabaseSystemEventDao
Modifier and Type | Field and Description |
---|---|
static String |
BC_DISABLE_SCHEDULED_JOB |
static String |
BC_UPDATE_SCHEDULED_JOB_EXECUTED |
protected javax.persistence.EntityManager |
em |
protected int |
eventCandidateDeletionPageSize |
protected IncognitoFilterStateHelper |
helper |
Constructor and Description |
---|
DatabaseSystemEventDaoImpl() |
Modifier and Type | Method and Description |
---|---|
ProcessedEvent |
addFinishedNode(Long eventId,
String nodeId)
Add a completion marker that signifies a node has completed an event.
|
void |
clear()
Perform an
EntityManager.clear() |
RegisteredNode |
createNewNode(String nodeId,
String ipAddress,
EventWorkerType workerType) |
void |
delete(MasterScheduledJobNode node) |
void |
deleteExecutedSingleUseJobs(org.broadleafcommerce.common.util.StreamingTransactionCapableUtil transUtil)
Delete non-recurring jobs.
|
void |
deleteJob(Long jobId)
Remove job based on the provided job id.
|
void |
deleteOldEvents(org.broadleafcommerce.common.util.StreamingTransactionCapableUtil transUtil)
Delete events from the system that are considered complete.
|
void |
deleteOldNodes(Date thresholdDate)
Remove nodes from the system that have not participated in a heartbeat check since the threshold date.
|
SystemEvent |
disableEvent(SystemEvent systemEvent)
Disable an event so that it will not be processed.
|
void |
disableScheduledJob(Long jobId) |
void |
enableEventsForProcess(Long processStatusMarker)
Mass enable all events based on a marker.
|
RegisteredNode |
find(String nodeId) |
List<RegisteredNode> |
findActiveNodes(Date thresholdDate)
Find all nodes that have a heart beat status newer than the threshold.
|
ScheduledJob |
findJob(Long id) |
MasterScheduledJobNode |
findMasterDeployNode() |
MasterScheduledJobNode |
findMasterNode() |
SystemEvent |
findSystemEvent(Long eventId) |
SystemEventDetail |
findSystemEventDetailByNameAndValueAndEventType(String eventDetailsName,
String eventDetailValue,
String eventType) |
SystemEvent |
finishEventInUseState(SystemEvent systemEvent)
Mark a VM scoped event as being finished with processing by a node.
|
List<SystemEvent> |
getLatestDurableEvents(Date lowDate,
Date lastProcessedDate,
List<Long> alreadyProcessedOnDate,
List<Long> toRetryFromError,
int startPos,
int pageSize,
EventWorkerType workerType)
Retrieve events of type DURABLE_GLOBAL.
|
Long |
getLatestDurableEventsCount(Date lowDate,
Date lastProcessedDate,
List<Long> alreadyProcessedOnDate,
List<Long> toRetryFromError,
EventWorkerType workerType) |
List<SystemEvent> |
getLatestEvents(Date lowDate,
int startPos,
int pageSize,
EventWorkerType workerType,
List<Long> excludeIds)
Get the list of
EventScopeType.VM events that were created after the lowDate that have not already been executed by this node. |
Long |
getLatestEventsCount(Date lowDate,
EventWorkerType workerType) |
List<SystemEvent> |
getLatestGlobalEvents(Date lowDate,
int startPos,
int pageSize,
EventWorkerType workerType,
String nodeId,
List<Long> excludeIds)
Get the list of
EventScopeType.GLOBAL events that were created after the lowDate that have not already been executed by this node. |
List<SystemEvent> |
getLatestPriorityEvents(Date lowDate,
int startPos,
int pageSize,
EventWorkerType workerType,
String nodeId,
List<Long> excludeIds)
Get the list of priority events that were created after the lowDate that have not already been executed by this node.
|
List<SystemEvent> |
getLatestScheduledDeployEvents(int startPos,
int pageSize) |
Date |
getMaxEventDateForNode(EventWorkerType workerType,
String nodeId)
Find the latest date of event that has been completed by this node.
|
Date |
getNodeTimestamp(String nodeId) |
boolean |
lockGlobalEvent(SystemEvent systemEvent,
Long nodeId)
Deprecated.
|
boolean |
lockSerialEvent(SystemEvent systemEvent) |
boolean |
lockSerialEvent(SystemEvent systemEvent,
String nodeId)
Lock the event of type
SystemEvent.getType() . |
void |
markJobAsExecuted(Long scheduledJobId) |
boolean |
nodeExists(String nodeId)
Determine if a node registration exists in the database for the given id.
|
boolean |
optimisticUnlockSerialEvent(String key)
Unlock a serial event using optimistic locking.
|
void |
purgeDerelictMasterDeployNode(Date updated) |
void |
purgeDerelictMasterNode(Date updated)
Remove the master node registration from the database if the time provided is less than the current time.
|
List<ScheduledJob> |
readNewScheduledJobs() |
List<ScheduledJob> |
readScheduledJobs() |
RegisteredNode |
refresh(RegisteredNode node) |
void |
refresh(SystemEvent event) |
void |
removeLock(SystemEvent systemEvent)
Deprecated.
|
void |
save(List<SystemEvent> events) |
MasterScheduledJobNode |
save(MasterScheduledJobNode node) |
RegisteredNode |
save(RegisteredNode node) |
ScheduledJob |
save(ScheduledJob job) |
SystemEvent |
save(SystemEvent systemEvent) |
protected SystemEvent |
saveInternal(SystemEvent systemEvent,
boolean preventDuplicates) |
SystemEvent |
startEventInUseState(SystemEvent systemEvent)
Mark a VM scoped event as being processed by a node (other node will ignore the event).
|
void |
unlockSerialEvent(String key) |
void |
updateMasterDeployTimestamp() |
void |
updateMasterTimestamp() |
void |
updateMaxEventDate(Date maxEventDate) |
void |
updateMaxEventDate(String nodeId,
Date maxEventDate)
Update the time that the node is marked to have completed its last event.
|
void |
updateNodeTimestamp(String nodeId) |
public static final String BC_UPDATE_SCHEDULED_JOB_EXECUTED
public static final String BC_DISABLE_SCHEDULED_JOB
protected javax.persistence.EntityManager em
protected IncognitoFilterStateHelper helper
@Value(value="${database.event.candidate.deletion.pagesize:50}") protected int eventCandidateDeletionPageSize
public boolean nodeExists(String nodeId)
DatabaseSystemEventDao
nodeExists
in interface DatabaseSystemEventDao
RegisteredNode
public RegisteredNode find(String nodeId)
find
in interface DatabaseSystemEventDao
public SystemEvent findSystemEvent(Long eventId)
findSystemEvent
in interface DatabaseSystemEventDao
public ProcessedEvent addFinishedNode(Long eventId, String nodeId)
DatabaseSystemEventDao
addFinishedNode
in interface DatabaseSystemEventDao
public MasterScheduledJobNode findMasterNode()
findMasterNode
in interface DatabaseSystemEventDao
public MasterScheduledJobNode findMasterDeployNode()
findMasterDeployNode
in interface DatabaseSystemEventDao
public List<SystemEvent> getLatestEvents(Date lowDate, int startPos, int pageSize, EventWorkerType workerType, List<Long> excludeIds)
DatabaseSystemEventDao
EventScopeType.VM
events that were created after the lowDate that have not already been executed by this node. Also, do
this in a paged fashion.getLatestEvents
in interface DatabaseSystemEventDao
lowDate
- - deprecated (no longer used in query)public List<SystemEvent> getLatestGlobalEvents(Date lowDate, int startPos, int pageSize, EventWorkerType workerType, String nodeId, List<Long> excludeIds)
DatabaseSystemEventDao
EventScopeType.GLOBAL
events that were created after the lowDate that have not already been executed by this node. Also, do
this in a paged fashion. This does not include events of type DURABLE_GLOBAL. See DatabaseSystemEventDao.getLatestDurableEvents(java.util.Date, java.util.Date, java.util.List, java.util.List, int, int, com.broadleafcommerce.jobsevents.service.type.EventWorkerType)
for retrieving durable events.getLatestGlobalEvents
in interface DatabaseSystemEventDao
public List<SystemEvent> getLatestPriorityEvents(Date lowDate, int startPos, int pageSize, EventWorkerType workerType, String nodeId, List<Long> excludeIds)
DatabaseSystemEventDao
PriorityConsumeWorkerImpl
for additional discussion on priority events.getLatestPriorityEvents
in interface DatabaseSystemEventDao
public List<SystemEvent> getLatestScheduledDeployEvents(int startPos, int pageSize)
getLatestScheduledDeployEvents
in interface DatabaseSystemEventDao
public List<SystemEvent> getLatestDurableEvents(Date lowDate, Date lastProcessedDate, List<Long> alreadyProcessedOnDate, List<Long> toRetryFromError, int startPos, int pageSize, EventWorkerType workerType)
DatabaseSystemEventDao
DurableEventStatusInfo
, which is harvested from a local store maintained
by DurableEventStatusService
.getLatestDurableEvents
in interface DatabaseSystemEventDao
public Long getLatestDurableEventsCount(Date lowDate, Date lastProcessedDate, List<Long> alreadyProcessedOnDate, List<Long> toRetryFromError, EventWorkerType workerType)
getLatestDurableEventsCount
in interface DatabaseSystemEventDao
public Date getMaxEventDateForNode(EventWorkerType workerType, String nodeId)
DatabaseSystemEventDao
getMaxEventDateForNode
in interface DatabaseSystemEventDao
public ScheduledJob save(ScheduledJob job)
save
in interface DatabaseSystemEventDao
public List<ScheduledJob> readScheduledJobs()
readScheduledJobs
in interface DatabaseSystemEventDao
public List<ScheduledJob> readNewScheduledJobs()
readNewScheduledJobs
in interface DatabaseSystemEventDao
public void markJobAsExecuted(Long scheduledJobId)
markJobAsExecuted
in interface DatabaseSystemEventDao
public Long getLatestEventsCount(Date lowDate, EventWorkerType workerType)
getLatestEventsCount
in interface DatabaseSystemEventDao
public RegisteredNode createNewNode(String nodeId, String ipAddress, EventWorkerType workerType)
createNewNode
in interface DatabaseSystemEventDao
public RegisteredNode save(RegisteredNode node)
save
in interface DatabaseSystemEventDao
public void updateNodeTimestamp(String nodeId)
updateNodeTimestamp
in interface DatabaseSystemEventDao
public Date getNodeTimestamp(String nodeId)
getNodeTimestamp
in interface DatabaseSystemEventDao
public RegisteredNode refresh(RegisteredNode node)
refresh
in interface DatabaseSystemEventDao
public void updateMaxEventDate(String nodeId, Date maxEventDate)
DatabaseSystemEventDao
updateMaxEventDate
in interface DatabaseSystemEventDao
public void updateMaxEventDate(Date maxEventDate)
updateMaxEventDate
in interface DatabaseSystemEventDao
public MasterScheduledJobNode save(MasterScheduledJobNode node)
save
in interface DatabaseSystemEventDao
public void updateMasterTimestamp()
updateMasterTimestamp
in interface DatabaseSystemEventDao
public void updateMasterDeployTimestamp()
updateMasterDeployTimestamp
in interface DatabaseSystemEventDao
public void delete(MasterScheduledJobNode node)
delete
in interface DatabaseSystemEventDao
public void purgeDerelictMasterNode(Date updated)
DatabaseSystemEventDao
purgeDerelictMasterNode
in interface DatabaseSystemEventDao
public void purgeDerelictMasterDeployNode(Date updated)
purgeDerelictMasterDeployNode
in interface DatabaseSystemEventDao
public SystemEvent save(SystemEvent systemEvent)
save
in interface DatabaseSystemEventDao
public void clear()
DatabaseSystemEventDao
EntityManager.clear()
clear
in interface DatabaseSystemEventDao
public void refresh(SystemEvent event)
refresh
in interface DatabaseSystemEventDao
protected SystemEvent saveInternal(SystemEvent systemEvent, boolean preventDuplicates)
public boolean lockSerialEvent(SystemEvent systemEvent, String nodeId)
DatabaseSystemEventDao
SystemEvent.getType()
. No other event
of this type will be able to execute on any node in the cluster until this event completes consumption.lockSerialEvent
in interface DatabaseSystemEventDao
public boolean lockSerialEvent(SystemEvent systemEvent)
lockSerialEvent
in interface DatabaseSystemEventDao
@Deprecated public boolean lockGlobalEvent(SystemEvent systemEvent, Long nodeId)
DatabaseSystemEventDao
lockGlobalEvent
in interface DatabaseSystemEventDao
@Deprecated public void removeLock(SystemEvent systemEvent)
DatabaseSystemEventDao
removeLock
in interface DatabaseSystemEventDao
public void unlockSerialEvent(String key)
unlockSerialEvent
in interface DatabaseSystemEventDao
public boolean optimisticUnlockSerialEvent(String key)
DatabaseSystemEventDao
optimisticUnlockSerialEvent
in interface DatabaseSystemEventDao
public SystemEvent disableEvent(SystemEvent systemEvent)
DatabaseSystemEventDao
disableEvent
in interface DatabaseSystemEventDao
public SystemEvent startEventInUseState(SystemEvent systemEvent)
DatabaseSystemEventDao
EventLockUtil
class.startEventInUseState
in interface DatabaseSystemEventDao
systemEvent
- event with scope type of VMpublic SystemEvent finishEventInUseState(SystemEvent systemEvent)
DatabaseSystemEventDao
EventLockUtil
class.finishEventInUseState
in interface DatabaseSystemEventDao
systemEvent
- event with scope type of VMpublic void deleteOldNodes(Date thresholdDate)
DatabaseSystemEventDao
deleteOldNodes
in interface DatabaseSystemEventDao
public List<RegisteredNode> findActiveNodes(Date thresholdDate)
DatabaseSystemEventDao
findActiveNodes
in interface DatabaseSystemEventDao
public void disableScheduledJob(Long jobId)
disableScheduledJob
in interface DatabaseSystemEventDao
public void deleteJob(Long jobId)
DatabaseSystemEventDao
deleteJob
in interface DatabaseSystemEventDao
public ScheduledJob findJob(Long id)
findJob
in interface DatabaseSystemEventDao
public void deleteExecutedSingleUseJobs(org.broadleafcommerce.common.util.StreamingTransactionCapableUtil transUtil)
DatabaseSystemEventDao
ScheduledJob.getTargetDate()
deleteExecutedSingleUseJobs
in interface DatabaseSystemEventDao
public void deleteOldEvents(org.broadleafcommerce.common.util.StreamingTransactionCapableUtil transUtil)
DatabaseSystemEventDao
deleteOldEvents
in interface DatabaseSystemEventDao
public void enableEventsForProcess(Long processStatusMarker)
DatabaseSystemEventDao
SystemEvent.getProcessStatusMarker()
enableEventsForProcess
in interface DatabaseSystemEventDao
public void save(List<SystemEvent> events)
save
in interface DatabaseSystemEventDao
public SystemEventDetail findSystemEventDetailByNameAndValueAndEventType(String eventDetailsName, String eventDetailValue, String eventType)
findSystemEventDetailByNameAndValueAndEventType
in interface DatabaseSystemEventDao
Copyright © 2019. All rights reserved.