Deletes the Google Cloud Pub/Sub subscription.

@throws IOException if there is a problem deleting the Pub/Sub subscription
170957
private void deletePubsubSubscription(String subscription) throws IOException {
    if (pubsubClient == null) {
      pubsubClient = newPubsubClient(options.as(PubsubOptions.class)).build();
    }
    if (executeNullIfNotFound(pubsubClient.projects().subscriptions().get(subscription)) != null) {
      pubsubClient.projects().subscriptions().delete(subscription).execute();
    }
  }
976052
protected void doUnsubscribe (int oid, Subscriber<?> target)
    {
        DObject dobj = _ocache.get(oid);
        if (dobj != null) {
            dobj.removeSubscriber(target);

        } else if (_client.isFailureLoggable(Client.FailureType.UNSUBSCRIBE_NOT_PROXIED)) {
            log.info("Requested to remove subscriber from non-proxied object", "oid", oid,
                     "sub", target);
        }
    }
1113211
public synchronized void deleteAllPubSubOutputHandlers()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "deleteAllPubSubOutputHandlers");

        _pubsubOutputHandlerLockManager.lockExclusive();
        _pubsubOutputHandlers.clear();
        _pubsubOutputHandlerLockManager.unlockExclusive();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deleteAllPubSubOutputHandlers");
    }
245998
def delete_subscription(self, subscription_id):
        
        self._validate_uuid(subscription_id)

        url = "/notification/v1/subscription/{}".format(subscription_id)
        response = NWS_DAO().deleteURL(url, self._write_headers())

        if response.status != 204:
            raise DataFailureException(url, response.status, response.data)

        return response.status
816472
private void terminateSubscriptions(String heapUri, Subscription.CloseReason reason) {
        HeapState state = heapStates.get(heapUri);
        if (state != null) {
            try {
                state.getUpdateLock().lock();
                subTermLock.lock();
                // if someone got here first, don't bother doing the work
                if (!state.isTerminated()) {
                    heapStates.remove(heapUri);
                    heapUris.remove(state.getHeapId());
                    List<IoSession> sessions = state.getSessions();
                    for (IoSession session : sessions) {
                        terminateSubscriptions(session, state, heapUri, reason);
                    }
                    LOGGER.error("Terminating heap state '{}'", heapUri);
                    state.terminate();
                    state.removeListener();
                }
            } finally {
                subTermLock.unlock();
                state.getUpdateLock().unlock();
            }
        }
    }
587002
public void deleteLocalDurableSubscription(
                                               String subscriptionId)
                    throws
                    SIResourceException,
                    SIMPDestinationLockedException,
                    SIDurableSubscriptionNotFoundException
    {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "deleteLocalDurableSubscription",
                        new Object[] { subscriptionId });

        // Lock the table of durable subscriptions to prevent others accessing the subscription 
        // We must perform the following work inside the sync block, in the following
        // order to protect against any chance of a duplicate subscription:
        // - Find the ConsumerDispatcher from the map
        // - Find the matching subscription item stream
        // - Persist the toBeDeleted flag on the item stream, so that it can never pop
        //   back into existence in the future.
        // - Remove the ConsumerDispatcher from both the map and subscription index,
        //   allowing a new subscription to be created with the same ID
        // We can then release the lock before attempting to cleanup the messages on the
        // existing subscription.
        DurableSubscriptionItemStream rstream = null;
        synchronized (_consumerDispatchersDurable)
        {
            // Get the consumer dispatcher from the table of durable subscriptions
            ConsumerDispatcher consumerDispatcher =
                            (ConsumerDispatcher) _consumerDispatchersDurable.get(subscriptionId);

            if (consumerDispatcher == null
                || !consumerDispatcher.getConsumerDispatcherState().isReady())
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(
                               tc,
                               "deleteLocalDurableSubscription",
                               "Sub not found " + subscriptionId);
                throw new SIDurableSubscriptionNotFoundException(
                                nls.getFormattedMessage(
                                                        "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0146",
                                                        new Object[] {
                                                                      subscriptionId,
                                                                      _messageProcessor.getMessagingEngineName() },
                                                        null));
            }

            // If consumers are attached to this consumerDispatcher then reject the delete.
            if (consumerDispatcher.hasConsumersAttached())
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(
                               tc,
                               "deleteLocalDurableSubscription",
                               " SIDestinationLockedException" + subscriptionId);

                throw new SIMPDestinationLockedException(// defect 177277
                nls.getFormattedMessage(
                                        "SUBSCRIPTION_IN_USE_ERROR_CWSIP0152",
                                        new Object[] {
                                                      subscriptionId,
                                                      _messageProcessor.getMessagingEngineName() },
                                        null),
                                SIMPDestinationLockedException.CONSUMERS_ATTACHED);
            }

            // Now find the matching item stream, using the consumer dispatcher
            final SubscriptionStateFilter subStateFilter =
                            new SubscriptionStateFilter();
            subStateFilter.setConsumerDispatcherStateFilter(consumerDispatcher.getConsumerDispatcherState());

            try
            {
                // Find the subscription in the topicspace itemstream
                rstream = (DurableSubscriptionItemStream) _pubsubMessageItemStream.
                                findFirstMatchingReferenceStream(subStateFilter);

                // Check there are no in-doubt receives on this stream.
                // Note this does not prevent us deleting a stream with in-doubt sends, which
                // is correct as producers sending to a subscription shouldn't prevent the
                // subscriber from deleting its subscription.
                if (rstream != null)
                {
                    if (rstream.getStatistics().getRemovingItemCount() != 0)
                    {
                        // There are uncommitted gets on this stream.           // 177786
                        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                            SibTr.exit(
                                       tc,
                                       "deleteLocalDurableSubscription",
                                       "SIDestinationLockedException"
                                                       + rstream.getStatistics().getUnavailableItemCount()
                                                       + ":"
                                                       + subscriptionId);

                        throw new SIMPDestinationLockedException(
                                        nls.getFormattedMessage("SUBSCRIPTION_IN_USE_ERROR_CWSIP0153",
                                                                new Object[] { subscriptionId, _messageProcessor.getMessagingEngineName() },
                                                                null),
                                        SIMPDestinationLockedException.UNCOMMITTED_MESSAGES);
                    }
                }

            } catch (MessageStoreException e)
            {
                // MessageStoreException shouldn't occur so FFDC.
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.destination.PubSubRealization.deleteLocalDurableSubscription",
                                            "1:1472:1.35.2.4",
                                            this);

                SibTr.exception(tc, e);
                SibTr.error(
                            tc,
                            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                            new Object[] {
                                          "com.ibm.ws.sib.processor.impl.destination.PubSubRealization",
                                          "1:1481:1.35.2.4",
                                          e,
                                          subscriptionId });

                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "deleteLocalDurableSubscription", e);

                throw new SIResourceException(
                                nls.getFormattedMessage(
                                                        "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                                                        new Object[] {
                                                                      "com.ibm.ws.sib.processor.impl.destination.PubSubRealization",
                                                                      "1:1493:1.35.2.4",
                                                                      e,
                                                                      subscriptionId },
                                                        null),
                                e);
            }

            // Mark the subscription to be deleted, and persist the flag
            boolean persistingToBeDeletedFlag = false;
            try
            {
                if (rstream != null)
                {
                    rstream.markAsToBeDeleted();
                    if (rstream.isInStore())
                    {
                        // If we fail while performing the persistent update,
                        // we need to rollback the toBeDeleted mark.
                        persistingToBeDeletedFlag = true;
                        rstream.requestUpdate(
                                        _messageProcessor.getTXManager().createAutoCommitTransaction());
                        persistingToBeDeletedFlag = false;
                    }
                }
            } catch (MessageStoreException e)
            {
                // MessageStoreException shouldn't occur so FFDC.
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.destination.PubSubRealization.deleteLocalDurableSubscription",
                                            "1:1523:1.35.2.4",
                                            this);

                SibTr.exception(tc, e);
                SibTr.error(
                            tc,
                            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                            new Object[] {
                                          "com.ibm.ws.sib.processor.impl.destination.PubSubRealization",
                                          "1:1532:1.35.2.4",
                                          e,
                                          subscriptionId });

                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "deleteLocalDurableSubscription", e);

                throw new SIResourceException(
                                nls.getFormattedMessage(
                                                        "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                                                        new Object[] {
                                                                      "com.ibm.ws.sib.processor.impl.destination.PubSubRealization",
                                                                      "1:1544:1.35.2.4",
                                                                      e,
                                                                      subscriptionId },
                                                        null),
                                e);
            } finally
            {
                if (persistingToBeDeletedFlag)
                {
                    // We failed while persisting the toBeDeleted flag.
                    // We cannot remove the subscription from the in-memory tables, as otherwise
                    // we could have a duplicate subscription on restart if the user created a new one.
                    // As such we unmark the deletion before throwing the exception, allowing the user
                    // to continue to use this subscription (and attempt the deletion again later).
                    rstream.clearToBeDeleted();
                }
            }

            // Now we can safely remove this subscription from our map, allowing the
            // user to create a new subscription with the same ID.
            // Remove consumerDispatcher from durable subscriptions table
            _consumerDispatchersDurable.remove(subscriptionId);

            // Delete consumerDispatcher ( implicit remove from matchspace) 
            try
            {
                // Delete from matchspace and send proxy message
                consumerDispatcher.deleteConsumerDispatcher(
                                true);
            } catch (SIException e)
            {
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.destination.PubSubRealization.deleteLocalDurableSubscription",
                                            "1:1580:1.35.2.4",
                                            this);

                SibTr.exception(tc, e);

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

        } // Drop synchronization on durable subscription map

        // If all was well, attempt cleanup of the subscription.
        if (rstream != null)
        {
            // Synchronization and exception handling all dealt with in SubscriptionItemStream
            rstream.deleteIfPossible(true);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deleteLocalDurableSubscription", subscriptionId);

    }
954848
private void cleanupSubscription(SubscriptionItemStream stream)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "cleanupSubscription", stream);
      
    try
    {
      // Indicate that we don't want the asynch deletion thread restarted if the 
      // subscription fails to delete, otherwise we might end up in a tight loop trying
      // to delete the subscription
      stream.deleteIfPossible(false);      
    }
    catch (Exception e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.AsynchDeletionThread.cleanupSubscription",
        "1:340:1.50",
        stream);
      
      if (tc.isDebugEnabled()) 
      {
        SibTr.debug(tc, "Failed to delete subscription " + stream);       
        SibTr.exception(tc, e);
      }
      
    }
    
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "cleanupSubscription");
  }
1368906
@Override
  public void cleanup()
      throws IOException {
    // Delete the staging file
    if (this.fs.exists(this.stagingFile)) {
      HadoopUtils.deletePath(this.fs, this.stagingFile, false);
    }
  }
1281378
public void close()
        throws IOException
    {
        if (server != null) {
            OutputStream os = getOutputStream();
            this.os = null;

            MuxServer server = this.server;
            this.server = null;

            server.close(channel);
        }
    }
1061988
@Override // Closeable
  public void close() throws IOException {
    journalStorage.close();
    imageStorage.close();
    
    IOUtils.closeStream(committedTxnId);
  }
229228
public void close ()
        throws IOException
    {
        if (_sock != null) {
            _sock.close();

            // clear out our references
            _sock = null;
            _in = null;
            _out = null;
        }
    }
376881
private void terminateSubscriptions(IoSession session, Subscription.CloseReason reason) {
        Multiset<String> heapsForThisClient;
        try {
            subTermLock.lock();
            heapsForThisClient = heapsByClient.remove(session);
        } finally {
            subTermLock.unlock();
        }

        if (heapsForThisClient != null) {
            for (String s : heapsForThisClient.keySet()) {
                terminateSubscriptions(session, s, reason);
            }
        }
    }
1241024
public void delete(URI uri, Credentials credentials) throws IOException {
		delete(uri, null, credentials);
	}
644235
@Override
    public synchronized void deletePubSubOutputHandler(SIBUuid8 neighbourUUID)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "deletePubSubOutputHandler", neighbourUUID);

        _pubSubRealization.deletePubSubOutputHandler(neighbourUUID);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deletePubSubOutputHandler");
    }
692063
public void close() throws IOException {
        if (dataStream != null) dataStream.close();
        byteStream = null;
        dataStream = null;
    }
563553
public void deleteStream(String domain, String app, String stream) {
        DeleteStreamRequest request = new DeleteStreamRequest()
                .withDomain(domain)
                .withApp(app)
                .withStream(stream);
        deleteStream(request);
    }
542551
def close_pub(self):
        '''
        
        '''
        if not self.cpub:
            return

        self.subscriber.close()
        self.subscriber = None
        self.pending_events = []
        self.cpub = False