class FlushTask implements ClusterTask<Void>
{
    /**
     * The unique identifier for the pubsub node that is the subject of the task, in case the task is specific to one
     * pubsub node. When this task should apply to all nodes, this value will be null.
     *
     * @see Node#getUniqueIdentifier()
     */
    @Nullable
	private Node.UniqueIdentifier uniqueIdentifier;

    /**
     * Instantiates a flush task for a specific node.
     *
     * @param uniqueIdentifier The identifier of the node to flush.
     */
	public FlushTask(@Nonnull final Node.UniqueIdentifier uniqueIdentifier )
	{
		this.uniqueIdentifier = uniqueIdentifier;
	}

    /**
     * Instantiates a flush task for a system-wide flush of pending changes.
     */
    public FlushTask()
    {
		this.uniqueIdentifier = null;
    }

    @Override
    public void run()
    {
		final PubSubPersistenceProvider provider = XMPPServer.getInstance().getPubSubModule().getPersistenceProvider();
		if ( provider instanceof CachingPubsubPersistenceProvider )
		{
			if ( uniqueIdentifier != null ) {
				((CachingPubsubPersistenceProvider) provider).flushPendingChanges(uniqueIdentifier, false ); // just this member
			} else {
				((CachingPubsubPersistenceProvider) provider).flushPendingChanges(false ); // just this member
			}
        }
	}

    @Override
    public Void getResult()
    {
        return null;
    }

    @Override
    public void writeExternal(ObjectOutput out) throws IOException
    {
		ExternalizableUtil.getInstance().writeBoolean( out, uniqueIdentifier != null);
		if ( uniqueIdentifier != null )
		{
			ExternalizableUtil.getInstance().writeSerializable( out, uniqueIdentifier );
		}
    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
    {<FILL_FUNCTION_BODY>}
}

		if ( ExternalizableUtil.getInstance().readBoolean( in ) ) {
		    uniqueIdentifier = (Node.UniqueIdentifier) ExternalizableUtil.getInstance().readSerializable( in );
		} else {
			this.uniqueIdentifier = null;
        }
	
<no_super_class>