forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-32349 Fix peer assessment and ScheduledInvocationManager (sakaipr…
…oject#4114) * SAK-32349 Cope with missing trigger. This fixes the issue. * SAK-32349 Add tests that attempt to check bug. This attempts to check that when a trigger doesn’t exist for a scheduled job things work as best they can. * SAK-32349 Use a new transaction for changes. This is a good solution because the calling code (in assignments) had it’s own hibernate transaction already established. The quartz code commits it’s transaction when it returns and so then second call through to quartz wouldn’t find the trigger that had just been deleted. So the fix to have the ScheduledInvocationManager use a new transaction for each call so it remains in sync with the quartz datastore. * SAK-32349 Update to use lombok on ContextMapping.
- Loading branch information
Showing
3 changed files
with
85 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 24 additions & 49 deletions
73
...ler-events-model/src/java/org/sakaiproject/scheduler/events/hibernate/ContextMapping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,42 @@ | ||
package org.sakaiproject.scheduler.events.hibernate; | ||
|
||
import javax.persistence.*; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
import javax.persistence.UniqueConstraint; | ||
|
||
/** | ||
* Just maps a context ID, component ID to a quartz trigger UUID. | ||
*/ | ||
@Entity(name = "context_mapping") | ||
@Table(uniqueConstraints={@UniqueConstraint(columnNames = {"componentId", "contextId"})}) | ||
@EqualsAndHashCode(exclude = {"uuid"}) | ||
@ToString | ||
public class ContextMapping { | ||
|
||
/** | ||
*This is the ID of the quartz trigger | ||
*/ | ||
@Id | ||
// This is the ID of the quartz trigger | ||
@Getter @Setter | ||
private String uuid; | ||
|
||
// This is the context ID (opaque ID) passed when the job was created. | ||
/** | ||
* This is the context ID (opaque ID) passed when the job was created. | ||
*/ | ||
@Getter @Setter | ||
private String contextId; | ||
|
||
// This is the component ID, we have this as a separate column so that overlapping context IDs (opaque IDs) aren't | ||
// a problem. | ||
/** | ||
* This is the component ID, we have this as a separate column so that overlapping context IDs (opaque IDs) aren't | ||
* a problem. | ||
*/ | ||
@Getter @Setter | ||
private String componentId; | ||
|
||
public String getContextId() { | ||
return contextId; | ||
} | ||
|
||
public void setContextId(String contextId) { | ||
this.contextId = contextId; | ||
} | ||
|
||
public String getUuid() { | ||
return uuid; | ||
} | ||
|
||
public void setUuid(String uuid) { | ||
this.uuid = uuid; | ||
} | ||
|
||
public String getComponentId() { | ||
return componentId; | ||
} | ||
|
||
public void setComponentId(String componentId) { | ||
this.componentId = componentId; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
ContextMapping that = (ContextMapping) o; | ||
|
||
if (!uuid.equals(that.uuid)) return false; | ||
if (!contextId.equals(that.contextId)) return false; | ||
return componentId.equals(that.componentId); | ||
|
||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = uuid.hashCode(); | ||
result = 31 * result + contextId.hashCode(); | ||
result = 31 * result + componentId.hashCode(); | ||
return result; | ||
} | ||
} |