@Override
    public void removeNode( Node node )
    {
        log.debug( "Removing node: {}", node.getUniqueIdentifier() );

        final PubSubService.UniqueIdentifier serviceIdentifier = node.getUniqueIdentifier().getServiceIdentifier();
        final Lock lock = serviceIdToNodesCache.getLock( serviceIdentifier );
        lock.lock();
        try {
            serviceIdToNodesCache.computeIfPresent( serviceIdentifier, ( s, collection ) -> {
                collection.remove( node );
                return collection.isEmpty() ? null : collection;
            } );
            if ( node instanceof LeafNode )
            {
                purgeNode( (LeafNode) node );
            }

            if ( node instanceof CollectionNode && node.getParent() == null ) {
                log.debug( "Node is the root node. Also removing other service references." );
                this.defaultNodeConfigurationCache.remove( getDefaultNodeConfigurationCacheKey( serviceIdentifier, true ) );
                this.defaultNodeConfigurationCache.remove( getDefaultNodeConfigurationCacheKey( serviceIdentifier, false ) );
                final Set<Node.UniqueIdentifier> toBeDeletedItemIds = this.itemsCache.keySet().stream().filter(key -> key.getServiceIdentifier().equals(serviceIdentifier)).collect(Collectors.toSet());
                for ( final Node.UniqueIdentifier itemId : toBeDeletedItemIds ) {
                    this.itemsCache.remove( itemId );
                }
            }
        } finally {
            lock.unlock();
        }
    }
Cache that holds all published items (mapped by node ID).
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/InMemoryPubSubPersistenceProvider.java