<commit_before>/**
 * Copyright (c) 2016, All Contributors (see CONTRIBUTORS file)
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.eventsourcing;

import com.eventsourcing.hlc.HybridTimestamp;
import com.eventsourcing.layout.LayoutIgnore;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.UUID;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.LinkedBlockingDeque;

public class Entity {

    private static LinkedBlockingDeque<UUID> uuids = new LinkedBlockingDeque<>(10_000);

    static {
        ForkJoinPool.commonPool().execute(() -> {
            while (true) {
                try {
                    uuids.put(UUID.randomUUID());
                } catch (InterruptedException e) {
                }
            }
        });
    }

    @Setter @Accessors(fluent = true)
    private UUID uuid;

    @LayoutIgnore
    public UUID uuid() {
        while (uuid == null) {
            try {
                uuid = uuids.take();
            } catch (InterruptedException e) {
            }
        }
        return uuid;<commit_msg>Problem: Entity static initializer uses ForkJoinPool that might reuse current thread<commit_after>/**
 * Copyright (c) 2016, All Contributors (see CONTRIBUTORS file)
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.eventsourcing;

import com.eventsourcing.hlc.HybridTimestamp;
import com.eventsourcing.layout.LayoutIgnore;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.UUID;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.LinkedBlockingDeque;

public class Entity {

    private static LinkedBlockingDeque<UUID> uuids = new LinkedBlockingDeque<>(10_000);

    static {
        new Thread(() -> {
            while (true) {
                try {
                    uuids.put(UUID.randomUUID());
                } catch (InterruptedException e) {
                }
            }
        }).start();
    }

    @Setter @Accessors(fluent = true)
    private UUID uuid;

    @LayoutIgnore
    public UUID uuid() {
        while (uuid == null) {
            try {
                uuid = uuids.take();
            } catch (InterruptedException e) {
            }
        }
        return uuid;
{'fraction_non_alphanumeric': 0.09862385321100918, 'fraction_numerical': 0.009938837920489297, 'mean_word_length': 2.300126103404792, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6959740', 'n_tokens_mistral': 795, 'n_tokens_neox': 749, 'n_words': 211}