@Override
    public PublishedItem getPublishedItem( LeafNode node, PublishedItem.UniqueIdentifier itemIdentifier )
    {
        log.debug( "Getting published item {} for node {}", itemIdentifier.getItemId(), node.getUniqueIdentifier() );

        PublishedItem lastPublishedItem = null;
        Set<PublishedItem> publishedItems;
        final Lock lock = itemsCache.getLock( node.getUniqueIdentifier() );
        lock.lock();
        try {
            publishedItems = itemsCache.get( node.getUniqueIdentifier() );
        } finally {
            lock.unlock();
        }

        if ( publishedItems != null )
        {
            final List<PublishedItem> collect = publishedItems.stream().filter( publishedItem -> publishedItem.getID().equals( itemIdentifier.getItemId() ) ).toList();
            if ( !collect.isEmpty() )
            {
                if ( collect.size() > 1 )
                {
                    log.warn( "Detected duplicate item key " + itemIdentifier.getItemId() + " usage for node " + node.getUniqueIdentifier().toString() );
                }
                lastPublishedItem = collect.get( collect.size() - 1 );
            }
        }
        return lastPublishedItem;
    }
Cache that holds all published items (mapped by node ID).
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/InMemoryPubSubPersistenceProvider.java