public void tombstoneEntry(final long leadershipTermId, final int entryIndex)
    {
        int index = -1;
        for (int i = 0, size = entries.size(); i < size; i++)
        {
            final Entry entry = entries.get(i);
            if (entry.leadershipTermId == leadershipTermId && entry.entryIndex == entryIndex)
            {
                index = entry.entryIndex;

                if (ENTRY_TYPE_TERM == entry.type)
                {
                    indexByLeadershipTermIdMap.remove(leadershipTermId);
                }

                break;
            }
        }

        if (-1 == index)
        {
            throw new ClusterException("unknown entry index: " + entryIndex);
        }

        buffer.putInt(0, NULL_VALUE, LITTLE_ENDIAN);
        byteBuffer.limit(SIZE_OF_INT).position(0);
        final long filePosition = (index * (long)ENTRY_LENGTH) + ENTRY_TYPE_OFFSET;

        try
        {
            if (SIZE_OF_INT != fileChannel.write(byteBuffer, filePosition))
            {
                throw new ClusterException("failed to write field atomically");
            }
        }
        catch (final Exception ex)
        {
            LangUtil.rethrowUnchecked(ex);
        }
    }
public void tombstoneEntry(final long leadershipTermId, final int entryIndex)
    {
        int index = -1;
        for (int i = 0, size = entries.size(); i < size; i++)
        {
            final Entry entry = entries.get(i);
            if (entry.leadershipTermId == leadershipTermId && entry.entryIndex == entryIndex)
            {
                index = entry.entryIndex;

                if (ENTRY_TYPE_TERM == entry.type)
                {
                    indexByLeadershipTermIdMap.remove(leadershipTermId);
                }

                break;
            }
        }

        if (-1 == index)
        {
            throw new ClusterException("unknown entry index: " + entryIndex);
        }

        buffer.putInt(0, NULL_VALUE, LITTLE_ENDIAN);
        byteBuffer.limit(SIZE_OF_INT).position(0);
        final long filePosition = (index * (long)ENTRY_LENGTH) + ENTRY_TYPE_OFFSET;

        try
        {
            if (SIZE_OF_INT != fileChannel.write(byteBuffer, filePosition))
            {
                throw new ClusterException("failed to write field atomically");
            }
        }
        catch (final Exception ex)
        {
            LangUtil.rethrowUnchecked(ex);
        }
    }
public void tombstoneEntry ( final long leadershipTermId , final int entryIndex ) { int index = - 1 ; for ( int i = 0 , size = entries . size ( ) ; i < size ; i ++ ) { final Entry entry = entries . get ( i ) ; if ( entry . leadershipTermId == leadershipTermId && entry . entryIndex == entryIndex ) { index = entry . entryIndex ; if ( ENTRY_TYPE_TERM == entry . type ) { indexByLeadershipTermIdMap . remove ( leadershipTermId ) ; } break ; } } if ( - 1 == index ) { throw new ClusterException ( "unknown entry index: " + entryIndex ) ; } buffer . putInt ( 0 , NULL_VALUE , LITTLE_ENDIAN ) ; byteBuffer . limit ( SIZE_OF_INT ) . position ( 0 ) ; final long filePosition = ( index * ( long ) ENTRY_LENGTH ) + ENTRY_TYPE_OFFSET ; try { if ( SIZE_OF_INT != fileChannel . write ( byteBuffer , filePosition ) ) { throw new ClusterException ( "failed to write field atomically" ) ; } } catch ( final Exception ex ) { LangUtil . rethrowUnchecked ( ex ) ; } }
Tombstone an entry in the log so it is no longer valid.

@param leadershipTermId to match for validation.
@param entryIndex       reached in the leadership term.
Tombstone an entry in the log so it is no longer valid .