Workaround for deadlock issue when attempting to create partitions for reference stores

A core bug has been identified, where attempting to create partitions for reference stores results in a deadlock: PIVOT-5759

Here’s a workaround for resolving this issue. can be overridden with the following to fix this issue. You can override the core version by placing this class into the package in your cvarc-starter module.

public IEpoch allocatePartitionContent() {
    final FutureValue < IEpoch > future = new FutureValue < > ();
    try {
        final var allocatePartitoinTask = new RecursiveAction() {
            private static final long serialVersionUID = 1 L;
            protected void compute() {
                try {
                } catch (Exception e) {
                    throw e;
        final var transactionPool = this.mixedWorkloadPool.getTransactionPool();
        if (transactionPool == ForkJoinTask.getPool()) {
        } else {
        // Do not call get() on the submitted task. The current thread could steal tasks that
        // use the same lock as the one we need to allocate the partition content.
        // We use a future to prevent the work stealing.
        return future.get();
    } catch (ExecutionException | InterruptedException e) {
        throw new ActiveViamRuntimeException(
            "Could not allocate partition content for partition " + partitionId +
            " of store " + store.getMetadata().getName() + ".", e);