Merge pull request #693 from jamesagnew/ConcurrentModificationRestSubscriptionFix
Fix to prevent rare Concurrent Modification Exceptions
This commit is contained in:
commit
cb2cea54d7
|
@ -83,7 +83,12 @@ public class RestHookSubscriptionDstu2Interceptor extends BaseRestHookSubscripti
|
||||||
* @param theOperation
|
* @param theOperation
|
||||||
*/
|
*/
|
||||||
private void checkSubscriptions(IIdType idType, String resourceType, RestOperationTypeEnum theOperation) {
|
private void checkSubscriptions(IIdType idType, String resourceType, RestOperationTypeEnum theOperation) {
|
||||||
for (Subscription subscription : myRestHookSubscriptions) {
|
//avoid a ConcurrentModificationException by copying to an array
|
||||||
|
for (Object object : myRestHookSubscriptions.toArray()) {
|
||||||
|
if (object == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Subscription subscription = (Subscription) object;
|
||||||
// see if the criteria matches the created object
|
// see if the criteria matches the created object
|
||||||
ourLog.info("Checking subscription {} for {} with criteria {}", subscription.getIdElement().getIdPart(), resourceType, subscription.getCriteria());
|
ourLog.info("Checking subscription {} for {} with criteria {}", subscription.getIdElement().getIdPart(), resourceType, subscription.getCriteria());
|
||||||
|
|
||||||
|
@ -121,6 +126,8 @@ public class RestHookSubscriptionDstu2Interceptor extends BaseRestHookSubscripti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an HTTP Post for a subscription
|
* Creates an HTTP Post for a subscription
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -82,7 +82,13 @@ public class RestHookSubscriptionDstu3Interceptor extends BaseRestHookSubscripti
|
||||||
* @param theOperation
|
* @param theOperation
|
||||||
*/
|
*/
|
||||||
private void checkSubscriptions(IIdType idType, String resourceType, RestOperationTypeEnum theOperation) {
|
private void checkSubscriptions(IIdType idType, String resourceType, RestOperationTypeEnum theOperation) {
|
||||||
for (Subscription subscription : myRestHookSubscriptions) {
|
//avoid a ConcurrentModificationException by copying to an array
|
||||||
|
for (Object object : myRestHookSubscriptions.toArray()) {
|
||||||
|
//for (Subscription subscription : myRestHookSubscriptions) {
|
||||||
|
if (object == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Subscription subscription = (Subscription) object;
|
||||||
// see if the criteria matches the created object
|
// see if the criteria matches the created object
|
||||||
ourLog.info("Checking subscription {} for {} with criteria {}", subscription.getIdElement().getIdPart(), resourceType, subscription.getCriteria());
|
ourLog.info("Checking subscription {} for {} with criteria {}", subscription.getIdElement().getIdPart(), resourceType, subscription.getCriteria());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue