class TransactionHandleRegistry implements TransactionRegistry {

    @Override
    public TransactionHandle terminate( long id ) throws TransactionLifecycleException
    {
        TransactionMarker marker = registry.get( id );
        if ( null == marker )
        {
            throw new InvalidTransactionId();
        }

        TransactionTerminationHandle handle = marker.getActiveTransaction().getTerminationHandle();
        handle.terminate();

        try
        {
            SuspendedTransaction transaction = marker.getSuspendedTransaction();
            if ( registry.replace( id, marker, marker.getActiveTransaction() ) )
            {
                return transaction.transactionHandle;
            }
        }
        catch ( InvalidConcurrentTransactionAccess exception )
        {
            // We could not acquire the transaction. Let the other request clean up.
        }
        return null;
    }

    public  TransactionHandleRegistry( Clock clock, long timeoutMillis, LogProvider logProvider );

}