Destroy the proxy & update the map containing the registration ref.

@param importDeclaration
181253
@Override
    protected void denyImportDeclaration(ImportDeclaration importDeclaration) {
        LOG.debug("CXFImporter destroy a proxy for " + importDeclaration);
        ServiceRegistration serviceRegistration = map.get(importDeclaration);
        serviceRegistration.unregister();

        // set the importDeclaration has unhandled
        super.unhandleImportDeclaration(importDeclaration);

        map.remove(importDeclaration);
    }
1284956
@Override
    public void setToBeDeleted()
    {
        super.setToBeDeleted();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "setToBeDeleted");

        // If there are durable subscriptions associated with the TopicSpace that is to be deleted
        // then we dereference them at this stage. This will remove entries from the matchspace.
        synchronized (_consumerDispatchersDurable)
        {
            // Iterate over the table of durable subscriptions.
            Iterator<Object> iter = _consumerDispatchersDurable.values().iterator();
            while (iter.hasNext())
            {
                Object obj = iter.next();
                // May not be a ConsumerDispatcher instance. eg may be a PendingDurableDelete object.
                if (obj instanceof ConsumerDispatcher)
                {
                    ConsumerDispatcher cd = (ConsumerDispatcher) obj;

                    // Does the CD belong to this destination
                    if (cd.getDestination().equals(_baseDestinationHandler))
                    {
                        // If the ConsumerDispatcher is in the MatchSpace, then dereference it but only if it
                        // doesn't currently have consumers attached (defect 518845)
                        if (cd.isInMatchSpace()
                            && !cd.hasConsumersAttached())
                        {
                            try
                            {
                                dereferenceSubscriptionConsumerDispatcher(
                                                                          cd,
                                                                          !cd.isDurable(),
                                                                          false); // don't call proxy code at this point
                            } catch (SIResourceException e)
                            {
                                // No FFDC code needed

                                // Trace the exception, we'll have FFDC'ed already and we want to allow
                                // processing to continue.
                                SibTr.exception(tc, e);
                            }
                        } //eof isInMatchSpace
                    } // eof matching DestinationHandlers
                } // eof instanceof ConsumerDispatcher
            } // eof while
        } // eof sync

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "setToBeDeleted");
    }
832697
public void destroyInternal() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "destroyInternal; " + this);
        }
        // Stop and destroy the chain. Ignore exceptions
        try {
            this.cf.stopChainInternal(getChain(), 0);
            this.cf.destroyChainInternal(getChain());
        } catch (ChannelException e) {
            // No FFDC required
        } catch (ChainException e) {
            // No FFCD required
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "destroyInternal");
        }
    }
984706
@Unbind(id = "importerServices")
    void unbindImporterService(ServiceReference<ImporterService> serviceReference) {

        LOG.debug(linkerName + " : Unbind the ImporterService " + importersManager.getDeclarationBinder(serviceReference));
        synchronized (lock) {
            importersManager.removeLinks(serviceReference);
            importersManager.remove(serviceReference);
        }
    }
362765
private CourierImportDeclarations addNthImport(CourierImportDeclaration importDecl) {
    CourierTopLevel root = getRoot();
    CourierImportDeclarations importDecls = root.getImportDeclarations();
    if (importDecl.getFullname() == null) {
      return importDecls;
    }

    boolean added = false;
    for (CourierImportDeclaration existing : importDecls.getImportDeclarationList()) {
      if (existing.getFullname() != null && importDecl.getFullname().toString().compareTo(existing.getFullname().toString()) < 0) {
        importDecls.addBefore(importDecl, existing);
        added = true;
        break;
      }
    }
    if (!added) {
      importDecls.add(importDecl);
    }
    return importDecls;
  }
1098438
protected void addOrRemoveGeneratedImport (boolean add)
    {
        final String IMPORT = "import javax.annotation.Generated;";

        int packageLine = -1;
        int importLine = -1;
        int lastJavaImport = -1;
        int firstNonJavaImport = -1;
        for (int ii = 0, nn = _lines.size(); ii < nn; ii++) {
            String line = _lines.get(ii);
            if (line.startsWith(IMPORT)) {
                if (add) {
                    return; // we already got one!
                }
                importLine = ii;
                break;

            } else if (line.startsWith("package ")) {
                packageLine = ii;

            } else if (line.startsWith("import java")) {
                lastJavaImport = ii;

            } else if (firstNonJavaImport == -1 && line.startsWith("import ")) {
                firstNonJavaImport = ii;
            }
        }

        if (importLine != -1) {
            // we must be removing, or we'd have already exited
            _lines.remove(importLine);

        } else if (!add) {
            return; // it's already not there!

        } else {
            importLine = (lastJavaImport != -1) ? lastJavaImport + 1
                : ((firstNonJavaImport != -1) ? firstNonJavaImport : packageLine + 1);
            _lines.add(importLine, IMPORT);
        }

        // the import line is always above these other lines, so they can be adjusted wholesale
        int adjustment = add ? 1 : -1;
        _nstart += adjustment;
        _nend += adjustment;
        _mstart += adjustment;
        _mend += adjustment;
    }
750126
public void unregisterPropertyExclusions( Class target ) {
      if( target != null ) {
         Set set = (Set) exclusionMap.get( target );
         if( set != null ) {
            set.clear();
         }
      }
   }
1158744
@Bind(id = "importerServices", specification = ImporterService.class, aggregate = true, optional = true)
    void bindImporterService(ServiceReference<ImporterService> serviceReference) {
        synchronized (lock) {
            try {
                importersManager.add(serviceReference);
            } catch (InvalidFilterException invalidFilterException) {
                LOG.error("The ServiceProperty \"" + TARGET_FILTER_PROPERTY + "\" of the ImporterService "
                                + bundleContext.getService(serviceReference) + " doesn't provides a valid Filter."
                                + " To be used, it must provides a correct \"" + TARGET_FILTER_PROPERTY + "\" ServiceProperty.",
                        invalidFilterException
                );
                return;
            }
            if (!importersManager.matched(serviceReference)) {
                return;
            }
            LOG.debug(linkerName + " : Bind the ImporterService "
                    + importersManager.getDeclarationBinder(serviceReference)
                    + " with filter " + importersManager.getTargetFilter(serviceReference));
            importersManager.createLinks(serviceReference);
        }
    }
715242
public static void tearDownExample(String host, int port, String user, String password, Authentication authType) {
    DatabaseClient client = DatabaseClientFactory.newClient(host, port, user, password, authType);

    ResourceExtensionsManager resourceMgr = client.newServerConfigManager().newResourceExtensionsManager();

    resourceMgr.deleteServices(HelloWorld.NAME);

    client.release();
  }
632981
function deregisterInteractionHandler(fnHandler) {
			var i,
				oParentDOM = this.$parent.get(0),
				oBlockLayerDOM = this.$blockLayer.get(0);

			if (oParentDOM) {
				for (i = 0; i < aPreventedEvents.length; i++) {
				// Remove event listeners with "useCapture" settings
					oParentDOM.removeEventListener(aPreventedEvents[i], fnHandler, {
						capture: true,
						passive: false
					});
				}
			}
			if (this._aSuppressHandler) {
				for (i = 0; i < this._aSuppressHandler.length; i++) {
					// this part should be done even no DOMRef exists
					EventTriggerHook.release(this._aSuppressHandler[i]);
				}
			}
			if (oBlockLayerDOM) {
				this.$blockLayer.unbind('keydown', fnHandler);
			}
		}
775130
void removeHandler( Object handlerRegistration )
	{
		// Through object's interface implementation
		if( handlerRegistration instanceof DirectHandlerInfo )
		{
			DirectHandlerInfo info = (DirectHandlerInfo) handlerRegistration;
			info.source.removePropertyChangedHandler( info.registrationObject );
			return;
		}
		
		if( ! ( handlerRegistration instanceof HandlerInfo ) )
			return;
		
		HandlerInfo info = (HandlerInfo) handlerRegistration;
	
		HashMap<String, ArrayList<PropertyChangedHandler>> handlersMap = PlatformSpecificProvider.get().getObjectMetadata( info.source );
		if( handlersMap == null )
			return;
	
		ArrayList<PropertyChangedHandler> handlerList = handlersMap.get( info.propertyName );
		if( handlerList == null )
			return;
	
		handlerList.remove( info.handler );
	
		if( handlerList.isEmpty() )
			handlersMap.remove( info.propertyName );
	
		if( handlersMap.isEmpty() )
			PlatformSpecificProvider.get().setObjectMetadata( info.source, null );
		
		stats.statsRemovedRegistration( info );
	
		info.handler = null;
		info.propertyName = null;
		info.source = null;
	}
567575
public void destroy()
    {
        super.destroy();
        if (isStarted())
            throw new IllegalStateException();

        _defaultsDescriptor=null;
        _war=null;
        _configurationClassNames=null;
        if (_resourceAliases!=null)
            _resourceAliases.clear();
        _resourceAliases=null;
        _contextListeners=null;
        if (_errorPages!=null)
            _errorPages.clear();
        _errorPages=null;
    }
1274438
public void destroy()
    {
        if (_realIn!=null)
            _realIn.destroy();
        _realIn=null;
        _deChunker=null;
        _expectContinues=null;
    }
232653
@Unbind(id = "exportDeclarations")
    void unbindExportDeclaration(ServiceReference<ExportDeclaration> exportDeclarationSRef) {
        LOG.debug(linkerName + " : Unbind the ExportDeclaration "
                + declarationsManager.getDeclaration(exportDeclarationSRef));

        synchronized (lock) {
            declarationsManager.removeLinks(exportDeclarationSRef);
            declarationsManager.remove(exportDeclarationSRef);
        }
    }
706291
private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException
    {
        if (implicitLocking)
        {
            Iterator i = cld.getObjectReferenceDescriptors(true).iterator();
            while (i.hasNext())
            {
                ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
                Object refObj = rds.getPersistentField().get(sourceObject);
                if (refObj != null)
                {
                    boolean isProxy = ProxyHelper.isProxy(refObj);
                    RuntimeObject rt = isProxy ? new RuntimeObject(refObj, this, false) : new RuntimeObject(refObj, this);
                    if (!registrationList.contains(rt.getIdentity()))
                    {
                        lockAndRegister(rt, lockMode, registeredObjects);
                    }
                }
            }
        }
    }
645461
private void deleteDurableSubscription(
    boolean callProxyCode)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "deleteDurableSubscription",
        new Object[] {
          new Boolean(callProxyCode) });

    HashMap durableSubsTable =
      _destinationManager.getDurableSubscriptionsTable();

    synchronized (durableSubsTable)
    {
      // Get the consumerDispatcher from the durable subscriptions table
      ConsumerDispatcher consumerDispatcher =
        (ConsumerDispatcher) durableSubsTable.get(
          _subState.getSubscriberID());

      //If entire topicspace has been deleted, the subscription will have already
      //been removed.
      if (consumerDispatcher != null)
      {
        // Check if the subscription from the durable subscriptions table is this
        // subscription.  Its possible that the topicspace this subscription was on
        // was deleted and a new subscription with the same id has been added into
        // the table
        if (consumerDispatcher.dispatcherStateEquals(_subState))
        {
          // Remove consumerDispatcher from durable subscriptions table
          durableSubsTable.remove(_subState.getSubscriberID());

          // Delete consumerDispatcher ( implicit remove from matchspace)
          try
          {
            // Don't need to send the proxy delete event message
            // just need to reset the memory to the stat
            consumerDispatcher.deleteConsumerDispatcher(
              callProxyCode);
          }
          catch (SIException e)
          {
            FFDCFilter.processException(
              e,
              "com.ibm.ws.sib.processor.impl.store.itemstreams.DurableSubscriptionItemStream.deleteDurableSubscription",
              "1:626:1.95",
              this);

            SibTr.exception(tc, e);

            // Could not delete consumer dispatcher
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.exit(tc, "deleteDurableSubscription", e);
          }
        }
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "deleteDurableSubscription");
  }
714486
public static void removeDeadClasses(CompilationUnit unit, CodeReferenceMap deadCodeMap) {
    ElementUtil elementUtil = unit.getEnv().elementUtil();
    Iterator<AbstractTypeDeclaration> iter = unit.getTypes().iterator();
    while (iter.hasNext()) {
      AbstractTypeDeclaration type = iter.next();
      TypeElement typeElement = type.getTypeElement();
      if (!ElementUtil.isGeneratedAnnotation(typeElement)) {
        if (deadCodeMap.containsClass(typeElement, elementUtil)) {
          type.setDeadClass(true);
        } else {
          // Keep class, remove dead interfaces.
          if (typeElement.getInterfaces().size() > 0) {
            GeneratedTypeElement replacement = GeneratedTypeElement.mutableCopy(typeElement);
            for (TypeElement intrface : ElementUtil.getInterfaces(typeElement)) {
              if (!deadCodeMap.containsClass(intrface, elementUtil)) {
                replacement.addInterface(intrface.asType());
              }
            }
            if (typeElement.getInterfaces().size() > replacement.getInterfaces().size()) {
              type.setTypeElement(replacement);
            }
          }
        }
      }
    }
  }