diff options
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java')
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java index fbd98bc13..89609baf7 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 IBM Corporation and others. + * Copyright (c) 2010, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -147,8 +147,11 @@ public final class WovenClassImpl implements WovenClass, HookContext { if (error != null) return; // do not call any other hooks once an error has occurred. if (hook instanceof WeavingHook) { - if (blackList.containsKey(hookRegistration)) - return; // black listed hook + if (skipRegistration(hookRegistration)) { + // Note we double check blacklist here just + // in case another thread blacklisted since the first check + return; + } if ((hookFlags & FLAG_HOOKCALLED) == 0) { hookFlags |= FLAG_HOOKCALLED; // only do this check on the first weaving hook call @@ -171,6 +174,11 @@ public final class WovenClassImpl implements WovenClass, HookContext { } } + @Override + public boolean skipRegistration(ServiceRegistration<?> hookRegistration) { + return blackList.containsKey(hookRegistration); + } + private boolean validBytes(byte[] checkBytes) { if (checkBytes == null || checkBytes.length < 4) return false; @@ -215,6 +223,11 @@ public final class WovenClassImpl implements WovenClass, HookContext { public String getHookMethodName() { return "modified"; //$NON-NLS-1$ } + + @Override + public boolean skipRegistration(ServiceRegistration<?> hookRegistration) { + return false; + } }; if (System.getSecurityManager() == null) registry.notifyHooksPrivileged(context); |