Code formatted according to checkstyle rules

pull/1923/head
Nikita Koksharov 6 years ago
parent 0090b8796d
commit 901a5a797b

@ -355,7 +355,7 @@
<execution> <execution>
<phase>verify</phase> <phase>verify</phase>
<goals> <goals>
<goal>checkstyle</goal> <goal>check</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>

@ -979,11 +979,6 @@ public class RedissonExecutorService implements RScheduledExecutorService {
private <T> RFuture<T> poll(List<RExecutorFuture<?>> futures, long timeout, TimeUnit timeUnit) throws InterruptedException { private <T> RFuture<T> poll(List<RExecutorFuture<?>> futures, long timeout, TimeUnit timeUnit) throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch = new CountDownLatch(1);
AtomicReference<RFuture<T>> result = new AtomicReference<>(); AtomicReference<RFuture<T>> result = new AtomicReference<>();
BiConsumer<T, Throwable> listener = new BiConsumer<T, Throwable>() {
@Override
public void accept(T t, Throwable u) {
}
};
for (Future<?> future : futures) { for (Future<?> future : futures) {
RFuture<T> f = (RFuture<T>) future; RFuture<T> f = (RFuture<T>) future;
f.onComplete((r, e) -> { f.onComplete((r, e) -> {

@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit;
* @author Nikita Koksharov * @author Nikita Koksharov
* *
*/ */
public class BatchOptions { public final class BatchOptions {
public enum ExecutionMode { public enum ExecutionMode {

@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit;
* @author Nikita Koksharov * @author Nikita Koksharov
* *
*/ */
public class ExecutorOptions { public final class ExecutorOptions {
private long taskRetryInterval = 5 * 60000; private long taskRetryInterval = 5 * 60000;

@ -28,7 +28,7 @@ import org.redisson.client.protocol.Time;
*/ */
public interface Node extends NodeAsync { public interface Node extends NodeAsync {
public enum InfoSection {ALL, DEFAULT, SERVER, CLIENTS, MEMORY, PERSISTENCE, STATS, REPLICATION, CPU, COMMANDSTATS, CLUSTER, KEYSPACE} enum InfoSection {ALL, DEFAULT, SERVER, CLIENTS, MEMORY, PERSISTENCE, STATS, REPLICATION, CPU, COMMANDSTATS, CLUSTER, KEYSPACE}
Map<String, String> info(InfoSection section); Map<String, String> info(InfoSection section);

@ -17,6 +17,7 @@ package org.redisson.api;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
/** /**
* Base asynchronous MultiMap interface. A collection that maps multiple values per one key. * Base asynchronous MultiMap interface. A collection that maps multiple values per one key.
* *
@ -140,7 +141,6 @@ public interface RMultimapAsync<K, V> extends RExpirableAsync {
RFuture<Collection<V>> getAllAsync(K key); RFuture<Collection<V>> getAllAsync(K key);
/** /**
* Returns the number of key-value pairs in this multimap. * Returns the number of key-value pairs in this multimap.
* *

@ -34,7 +34,7 @@ import org.redisson.client.protocol.ScoredEntry;
*/ */
public interface RScoredSortedSet<V> extends RScoredSortedSetAsync<V>, Iterable<V>, RExpirable, RSortable<Set<V>> { public interface RScoredSortedSet<V> extends RScoredSortedSetAsync<V>, Iterable<V>, RExpirable, RSortable<Set<V>> {
public enum Aggregate { enum Aggregate {
SUM, MAX, MIN SUM, MAX, MIN

@ -40,7 +40,7 @@ public interface RScript extends RScriptAsync {
MAPVALUE(RedisCommands.EVAL_MAP_VALUE), MAPVALUE(RedisCommands.EVAL_MAP_VALUE),
MAPVALUELIST(RedisCommands.EVAL_MAP_VALUE_LIST); MAPVALUELIST(RedisCommands.EVAL_MAP_VALUE_LIST);
RedisCommand<?> command; private final RedisCommand<?> command;
ReturnType(RedisCommand<?> command) { ReturnType(RedisCommand<?> command) {
this.command = command; this.command = command;

@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit;
* @author Nikita Koksharov * @author Nikita Koksharov
* *
*/ */
public class TransactionOptions { public final class TransactionOptions {
private long responseTimeout = 3000; private long responseTimeout = 3000;
private int retryAttempts = 3; private int retryAttempts = 3;

@ -36,7 +36,7 @@ import org.redisson.liveobject.resolver.NamingScheme;
@Target({ElementType.TYPE}) @Target({ElementType.TYPE})
public @interface REntity { public @interface REntity {
public enum TransformationMode { enum TransformationMode {
IMPLEMENTATION_BASED, IMPLEMENTATION_BASED,
@ -68,7 +68,7 @@ public @interface REntity {
*/ */
TransformationMode fieldTransformation() default TransformationMode.ANNOTATION_BASED; TransformationMode fieldTransformation() default TransformationMode.ANNOTATION_BASED;
static final class DEFAULT extends BaseCodec { final class DEFAULT extends BaseCodec {
@Override @Override
public Decoder<Object> getValueDecoder() { public Decoder<Object> getValueDecoder() {
return null; return null;

@ -15,8 +15,6 @@
*/ */
package org.redisson.api.annotation; package org.redisson.api.annotation;
import org.redisson.liveobject.resolver.NamingScheme;
import org.redisson.liveobject.resolver.DefaultNamingScheme;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
@ -26,7 +24,8 @@ import org.redisson.client.codec.BaseCodec;
import org.redisson.client.codec.Codec; import org.redisson.client.codec.Codec;
import org.redisson.client.protocol.Decoder; import org.redisson.client.protocol.Decoder;
import org.redisson.client.protocol.Encoder; import org.redisson.client.protocol.Encoder;
import org.redisson.codec.JsonJacksonCodec; import org.redisson.liveobject.resolver.DefaultNamingScheme;
import org.redisson.liveobject.resolver.NamingScheme;
/** /**
* By default <code>namingScheme</code> and/or <code>codec</code> parameters specified in {@link REntity} * By default <code>namingScheme</code> and/or <code>codec</code> parameters specified in {@link REntity}
@ -58,7 +57,7 @@ public @interface RObjectField{
*/ */
Class<? extends Codec> codec() default DEFAULT.class; Class<? extends Codec> codec() default DEFAULT.class;
static final class DEFAULT extends BaseCodec { final class DEFAULT extends BaseCodec {
@Override @Override
public Decoder<Object> getValueDecoder() { public Decoder<Object> getValueDecoder() {
return null; return null;

@ -68,6 +68,7 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ReplayingDecoder; import io.netty.handler.codec.ReplayingDecoder;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
import io.netty.util.concurrent.FastThreadLocal;
/** /**
* Redis protocol command decoder * Redis protocol command decoder
@ -112,14 +113,14 @@ public class CommandDecoder extends ReplayingDecoder<State> {
final ExecutorService executor; final ExecutorService executor;
private final boolean decodeInExecutor; private final boolean decodeInExecutor;
private final ThreadLocal<Status> decoderStatus = new ThreadLocal<Status>() { private final FastThreadLocal<Status> decoderStatus = new FastThreadLocal<Status>() {
@Override @Override
protected Status initialValue() { protected Status initialValue() {
return Status.NORMAL; return Status.NORMAL;
}; };
}; };
private final ThreadLocal<State> state = new ThreadLocal<State>(); private final FastThreadLocal<State> state = new FastThreadLocal<State>();
public CommandDecoder(ExecutorService executor, boolean decodeInExecutor) { public CommandDecoder(ExecutorService executor, boolean decodeInExecutor) {
this.decodeInExecutor = decodeInExecutor; this.decodeInExecutor = decodeInExecutor;

@ -529,7 +529,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
RFuture<Collection<RFuture<Void>>> future = addMasterEntry(newPart, cfg); RFuture<Collection<RFuture<Void>>> future = addMasterEntry(newPart, cfg);
future.onComplete((res, e) -> { future.onComplete((res, e) -> {
if (e == null) { if (e == null) {
futures.addAll(future.getNow()); futures.addAll(res);
} }
if (masters.decrementAndGet() == 0) { if (masters.decrementAndGet() == 0) {

@ -26,6 +26,7 @@ import org.redisson.client.protocol.Encoder;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufAllocator;
import io.netty.handler.codec.compression.Snappy; import io.netty.handler.codec.compression.Snappy;
import io.netty.util.concurrent.FastThreadLocal;
/** /**
* Snappy compression codec. * Snappy compression codec.
@ -39,13 +40,13 @@ import io.netty.handler.codec.compression.Snappy;
*/ */
public class SnappyCodec extends BaseCodec { public class SnappyCodec extends BaseCodec {
private static final ThreadLocal<Snappy> snappyDecoder = new ThreadLocal<Snappy>() { private static final FastThreadLocal<Snappy> snappyDecoder = new FastThreadLocal<Snappy>() {
protected Snappy initialValue() { protected Snappy initialValue() {
return new Snappy(); return new Snappy();
}; };
}; };
private static final ThreadLocal<Snappy> snappyEncoder = new ThreadLocal<Snappy>() { private static final FastThreadLocal<Snappy> snappyEncoder = new FastThreadLocal<Snappy>() {
protected Snappy initialValue() { protected Snappy initialValue() {
return new Snappy(); return new Snappy();
}; };

@ -232,17 +232,13 @@ public class MasterSlaveEntry {
return; return;
} }
System.out.println("reattachBlockingQueue " + connection);
try {
RFuture<RedisConnection> newConnectionFuture = connectionWriteOp(commandData.getCommand()); RFuture<RedisConnection> newConnectionFuture = connectionWriteOp(commandData.getCommand());
System.out.println("newConnectionFuture " + newConnectionFuture);
newConnectionFuture.onComplete((newConnection, e) -> { newConnectionFuture.onComplete((newConnection, e) -> {
if (e != null) { if (e != null) {
log.error("Can't resubscribe blocking queue " + commandData, e); log.error("Can't resubscribe blocking queue " + commandData, e);
return; return;
} }
System.out.println("newConnectionFuture1 " + connection);
AtomicBoolean skip = new AtomicBoolean(); AtomicBoolean skip = new AtomicBoolean();
BiConsumer<Object, Throwable> listener = new BiConsumer<Object, Throwable>() { BiConsumer<Object, Throwable> listener = new BiConsumer<Object, Throwable>() {
@Override @Override
@ -257,7 +253,6 @@ public class MasterSlaveEntry {
if (commandData.getPromise().isDone()) { if (commandData.getPromise().isDone()) {
return; return;
} }
System.out.println("newConnectionFuture2 " + connection);
ChannelFuture channelFuture = newConnection.send(commandData); ChannelFuture channelFuture = newConnection.send(commandData);
channelFuture.addListener(new ChannelFutureListener() { channelFuture.addListener(new ChannelFutureListener() {
@Override @Override
@ -267,17 +262,10 @@ public class MasterSlaveEntry {
skip.set(true); skip.set(true);
releaseWrite(newConnection); releaseWrite(newConnection);
log.error("Can't resubscribe blocking queue {}", commandData); log.error("Can't resubscribe blocking queue {}", commandData);
} else {
System.out.println("resubscribed " + connection);
} }
} }
}); });
}); });
} catch (Exception e2) {
e2.printStackTrace();
// TODO: handle exception
}
} }
public boolean hasSlave(RedisClient redisClient) { public boolean hasSlave(RedisClient redisClient) {

Loading…
Cancel
Save