class ExplicitBatchIndexApplier extends BatchTransactionApplier.Adapter {

    @Override
    public TransactionApplier startTx( CommandsToApply transaction ) throws IOException
    {
        long activeTransactionId = transaction.transactionId();
        try
        {
            // Cache transactionApplier because it has some expensive lookups
            if ( txApplier == null )
            {
                txApplier = new ExplicitIndexTransactionApplier( applierLookup, indexConfigStore, mode,
                        transactionOrdering );
            }

            if ( transaction.requiresApplicationOrdering() )
            {
                // Index operations must preserve order so wait for previous tx to finish
                transactionOrdering.waitFor( activeTransactionId );
                // And set current tx so we can notify the next transaction when we are finished
                if ( transaction.next() != null )
                {
                    // Let each transaction notify the next
                    txApplier.setTransactionId( activeTransactionId );
                }
                else
                {
                    // except the last transaction, which notifies that it is done after appliers have been closed
                    lastTransactionId = activeTransactionId;
                }
            }

            return txApplier;
        }
        catch ( InterruptedException e )
        {
            Thread.currentThread().interrupt();
            throw new IOException( "Interrupted while waiting for applying tx:" + activeTransactionId +
                    " explicit index updates", e );
        }
    }

    public  ExplicitBatchIndexApplier( IndexConfigStore indexConfigStore, ExplicitIndexApplierLookup applierLookup,
            IdOrderingQueue transactionOrdering, TransactionApplicationMode mode );

}