Fix to prevent rare Concurrent Modification Exceptions
This commit is contained in:
parent
f7d4296046
commit
a49e009cba
|
@ -83,7 +83,12 @@ public class RestHookSubscriptionDstu2Interceptor extends BaseRestHookSubscripti
|
|||
* @param 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
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -82,7 +82,13 @@ public class RestHookSubscriptionDstu3Interceptor extends BaseRestHookSubscripti
|
|||
* @param 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
|
||||
ourLog.info("Checking subscription {} for {} with criteria {}", subscription.getIdElement().getIdPart(), resourceType, subscription.getCriteria());
|
||||
|
||||
|
|
Loading…
Reference in New Issue