@Repository(value="blDatabaseSystemEventDao") public class DatabaseSystemEventDaoImpl extends Object implements DatabaseSystemEventDao
Modifier and Type | Field and Description |
---|---|
protected javax.persistence.EntityManager |
em |
protected Integer |
eventCandidateDeletionPagesize |
protected org.broadleafcommerce.profile.core.service.IdGenerationService |
idGenerationService |
Constructor and Description |
---|
DatabaseSystemEventDaoImpl() |
Modifier and Type | Method and Description |
---|---|
SystemEventNodeFinished |
addFinishedNode(Long eventId,
Long nodeId)
Add a completion marker that signifies a node has completed an event.
|
void |
clear()
Perform an
EntityManager.clear() |
NodeRegistration |
createNewNode(Long nodeId,
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 processMarker)
Mass enable all events based on a marker.
|
NodeRegistration |
find(Long nodeId) |
ScheduledJob |
findJob(Long id) |
MasterScheduledJobNode |
findMasterDeployNode() |
MasterScheduledJobNode |
findMasterNode() |
SystemEvent |
findSystemEvent(Long eventId) |
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,
int startPos,
int pageSize,
EventWorkerType workerType)
Retrieve events of type DURABLE_GLOBAL.
|
Long |
getLatestDurableEventsCount(Date lowDate,
Date lastProcessedDate,
List<Long> alreadyProcessedOnDate,
EventWorkerType workerType) |
List<SystemEvent> |
getLatestEvents(Date lowDate,
int startPos,
int pageSize,
EventWorkerType workerType,
Long nodeId)
Get the list of events that were created after the lowDate that have not already been executed by this node.
|
Long |
getLatestEventsCount(Date lowDate,
EventWorkerType workerType) |
List<SystemEvent> |
getLatestScheduledDeployEvents(int startPos,
int pageSize) |
Date |
getMaxEventDateForNode(EventWorkerType workerType,
Long nodeId)
Find the latest date of event that has been completed by this node.
|
Date |
getNodeTimestamp(Long nodeId) |
boolean |
lockGlobalEvent(SystemEvent systemEvent,
Long nodeId)
Lock the event on the node.
|
boolean |
lockSerialEvent(SystemEvent systemEvent)
Lock the event of type
SystemEvent.getType() . |
void |
markJobAsExecuted(Long scheduledJobId) |
boolean |
nodeExists(Long 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() |
NodeRegistration |
refresh(NodeRegistration node) |
void |
refresh(SystemEvent event) |
void |
removeLock(SystemEvent systemEvent)
Purge the lock record from the database
|
void |
save(List<SystemEvent> events) |
MasterScheduledJobNode |
save(MasterScheduledJobNode node) |
NodeRegistration |
save(NodeRegistration 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(Long nodeId,
Date maxEventDate)
Update the time that the node is marked to have completed its last event.
|
void |
updateNodeTimestamp(Long nodeId) |
protected javax.persistence.EntityManager em
protected org.broadleafcommerce.profile.core.service.IdGenerationService idGenerationService
@Value(value="${database.event.candidate.deletion.pagesize:1000}") protected Integer eventCandidateDeletionPagesize
public boolean nodeExists(Long nodeId)
DatabaseSystemEventDao
nodeExists
in interface DatabaseSystemEventDao
NodeRegistration
public NodeRegistration find(Long nodeId)
find
in interface DatabaseSystemEventDao
public SystemEvent findSystemEvent(Long eventId)
findSystemEvent
in interface DatabaseSystemEventDao
public SystemEventNodeFinished addFinishedNode(Long eventId, Long 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, Long nodeId)
DatabaseSystemEventDao
DatabaseSystemEventDao.getLatestDurableEvents(java.util.Date, java.util.Date, java.util.List, int, int, com.broadleafcommerce.jobsevents.service.type.EventWorkerType)
for retrieving durable events.getLatestEvents
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, 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, EventWorkerType workerType)
getLatestDurableEventsCount
in interface DatabaseSystemEventDao
public Date getMaxEventDateForNode(EventWorkerType workerType, Long 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 NodeRegistration createNewNode(Long nodeId, EventWorkerType workerType)
createNewNode
in interface DatabaseSystemEventDao
public NodeRegistration save(NodeRegistration node)
save
in interface DatabaseSystemEventDao
public void updateNodeTimestamp(Long nodeId)
updateNodeTimestamp
in interface DatabaseSystemEventDao
public Date getNodeTimestamp(Long nodeId)
getNodeTimestamp
in interface DatabaseSystemEventDao
public NodeRegistration refresh(NodeRegistration node)
refresh
in interface DatabaseSystemEventDao
public void updateMaxEventDate(Long 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)
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 lockGlobalEvent(SystemEvent systemEvent, Long nodeId)
DatabaseSystemEventDao
lockGlobalEvent
in interface DatabaseSystemEventDao
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 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 processMarker)
DatabaseSystemEventDao
SystemEvent.getProcessMarker()
enableEventsForProcess
in interface DatabaseSystemEventDao
public void save(List<SystemEvent> events)
save
in interface DatabaseSystemEventDao
Copyright © 2019. All rights reserved.