Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2013-2024 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson;
import org.redisson.api.Entry;
import org.redisson.api.RFuture;
import org.redisson.api.RPriorityBlockingDeque;
import org.redisson.api.RedissonClient;
import org.redisson.api.queue.DequeMoveArgs;
import org.redisson.client.codec.Codec;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.misc.CompletableFutureWrapper;
import java.time.Duration;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Function;
/**
*
Distributed and concurrent implementation of priority blocking deque.
*
*
Queue size limited by Redis server memory amount. This is why {@link #remainingCapacity()} always
* returns Integer.MAX_VALUE
*
* @author Nikita Koksharov
*/
public class RedissonPriorityBlockingDeque extends RedissonPriorityDeque implements RPriorityBlockingDeque {
private final RedissonPriorityBlockingQueue blockingQueue;
protected RedissonPriorityBlockingDeque(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson) {
super(commandExecutor, name, redisson);
blockingQueue = new RedissonPriorityBlockingQueue(commandExecutor, name, redisson);
}
protected RedissonPriorityBlockingDeque(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson) {
super(codec, commandExecutor, name, redisson);
blockingQueue = new RedissonPriorityBlockingQueue(codec, commandExecutor, name, redisson);
}
@Override
public void put(V e) throws InterruptedException {
add(e);
}
@Override
public boolean offer(V e, long timeout, TimeUnit unit) throws InterruptedException {
return offer(e);
}
@Override
public RFuture takeAsync() {
return blockingQueue.takeAsync();
}
@Override
public V take() throws InterruptedException {
return blockingQueue.take();
}
public RFuture pollAsync(long timeout, TimeUnit unit) {
return blockingQueue.pollAsync(timeout, unit);
}
@Override
public V poll(long timeout, TimeUnit unit) throws InterruptedException {
return blockingQueue.poll(timeout, unit);
}
@Override
public V pollFromAny(long timeout, TimeUnit unit, String... queueNames) throws InterruptedException {
throw new UnsupportedOperationException("use poll method");
}
@Override
public Entry pollFromAnyWithName(Duration timeout, String... queueNames) throws InterruptedException {
throw new UnsupportedOperationException("use poll method");
}
@Override
public RFuture> pollFromAnyWithNameAsync(Duration timeout, String... queueNames) {
throw new UnsupportedOperationException("use poll method");
}
@Override
public Map> pollFirstFromAny(Duration duration, int count, String... queueNames) throws InterruptedException {
throw new UnsupportedOperationException("use poll method");
}
@Override
public Map> pollLastFromAny(Duration duration, int count, String... queueNames) throws InterruptedException {
throw new UnsupportedOperationException("use poll method");
}
@Override
public RFuture