protected static boolean isEligible(String message) {

        try {
            lock.readLock().lock();

            if (hashSet.contains(message))
                return false;

        } finally {
            lock.readLock().unlock();
        }

        try {
            lock.writeLock().lock();

            if (buffer.size() >= 100) {
                String rem = buffer.remove();
                hashSet.remove(rem);
            }

            buffer.add(message);
            hashSet.add(message);

            return true;
        } finally {
            lock.writeLock().unlock();
        }
    }
@Test
    public void testBuffer1() throws Exception {
        assertTrue(OneTimeLogger.isEligible("Message here"));

        assertFalse(OneTimeLogger.isEligible("Message here"));

        assertTrue(OneTimeLogger.isEligible("Message here 23"));
    }