public synchronized CompletableFuture<?> addToQueue( @Nonnull final Packet stanza, @Nonnull final MUCOccupant sender ) {
            if( isJoinComplete() ) {
                throw new IllegalStateException( "Queueing a stanza is not expected to occur when federation has already been established." );
            }

            final CompletableFuture<?> result = new CompletableFuture<>();
            if ( callback.isDone() ) {
                result.complete(null);
            }

            Log.trace( "Adding stanza (type {}) from '{}' to queue, to be sent to peer as soon as federation has been established.", stanza.getClass().getSimpleName(), sender.getUserAddress() );
            queue.add( new QueuedStanza( stanza, sender, result ) );

            return result;
        }
Adds a stanza to be sent to the remote, joined MUC as soon as federation has been established.

This method is intended to be used only when federation is in progress of being established.

@param stanza The stanza to share
@param sender The author of the stanza
@return A future, indicating if local distribution of the stanza needs to wait.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/FMUCHandler.java