<commit_before>package org.redisson;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.redisson.api.RBlockingFairQueue;

public class RedissonBlockingFairQueueTest extends BaseTest {

    @Test
    public void testPollTimeout() throws InterruptedException {
        int size = 100;
        RBlockingFairQueue<String> queue = redisson.getBlockingFairQueue("test");

        CountDownLatch latch = new CountDownLatch(size);
        List<Thread> threads = new ArrayList<Thread>();
        for (int i = 0; i < size; i++) {
            final int j = i;
            Thread t = new Thread() {
                public void run() {
                    try {
                        String value = queue.poll(1, TimeUnit.SECONDS);
                        assertThat(value).isEqualTo("" + j);
                        latch.countDown();
                    } catch (InterruptedException e) {
                    }
                };
            };
            
            threads.add(t);
        }
        
        for (Thread thread : threads) {
            thread.start();
            thread.join(5);
        }
        
        for (int i = 0; i < size; i++) {
            queue.add("" + i);
        }
        
        assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue();
    }
    
}<commit_msg>Test fixed<commit_after>package org.redisson;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import org.junit.Assert;
import org.junit.Test;
import org.redisson.api.RBlockingFairQueue;
import org.redisson.api.RBlockingQueue;

public class RedissonBlockingFairQueueTest extends BaseTest {

    @Test
    public void testFairness() throws InterruptedException {
        int size = 10000;
        RBlockingQueue<String> queue = redisson.getBlockingQueue("test");

        CountDownLatch latch = new CountDownLatch(size);
        AtomicInteger t1Counter = new AtomicInteger();
        AtomicInteger t2Counter = new AtomicInteger();
        Thread t1 = new Thread("test-thread1") {
            public void run() {
                while (true) {
                    try {
                        String a = queue.poll(1, TimeUnit.SECONDS);
                        if (a == null) {
                            break;
                        }
                        latch.countDown();
                        t1Counter.incrementAndGet();
                    } catch (InterruptedException e) {
                    }
                }
            };
        };

        Thread t2 = new Thread("test-thread1") {
            public void run() {
                while (true) {
                    try {
                        String a = queue.poll(1, TimeUnit.SECONDS);
                        if (a == null) {
                            break;
                        }
                        Thread.sleep(5);
                        latch.countDown();
                        t2Counter.incrementAndGet();
                    } catch (InterruptedException e) {
                    }
                }
            };
        };
        
        for (int i = 0; i < size; i++) {
            queue.add("" + i);
        }

        t1.start();
        t2.start();
        
        t2.join();
        t1.join();

        assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue();
        System.out.println("t1: " + t1Counter.get());
        System.out.println("t2: " + t2Counter.get());
    }
    
}

{'fraction_non_alphanumeric': 0.10515078729650387, 'fraction_numerical': 0.009073925807312517, 'mean_word_length': 1.4528795811518325, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1117163', 'n_tokens_mistral': 1048, 'n_tokens_neox': 997, 'n_words': 208}