diff --git a/pom.xml b/pom.xml index 1e50e37c2..5224eb7f9 100644 --- a/pom.xml +++ b/pom.xml @@ -65,13 +65,7 @@ - release-sign-artifacts - - - performRelease - true - - + release @@ -118,7 +112,7 @@ net.ju-n.maven.plugins checksum-maven-plugin - 1.3 + 1.4 @@ -152,18 +146,32 @@ ${basedir}/src/test/java + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrepo + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins maven-release-plugin 2.5.3 - - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.9.5 - - - + + true + true + release + deploy + + + maven-compiler-plugin 3.8.0 @@ -201,6 +209,11 @@ + + public + -Xdoclint:none + true + diff --git a/redisson-all/pom.xml b/redisson-all/pom.xml index e0529a3e9..38aa5888f 100644 --- a/redisson-all/pom.xml +++ b/redisson-all/pom.xml @@ -145,12 +145,6 @@ 1.1.2.6 provided - - de.ruedigermoeller - fst - 2.47 - provided - org.springframework diff --git a/redisson/pom.xml b/redisson/pom.xml index 2985594e7..ec50019dd 100644 --- a/redisson/pom.xml +++ b/redisson/pom.xml @@ -301,46 +301,12 @@ - - - org.apache.maven.plugins - maven-jar-plugin - 3.0.2 - - - - test-jar - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.0.1 - - - attach-sources - - jar-no-fork - - - + maven-compiler-plugin - org.apache.maven.plugins maven-javadoc-plugin - 3.0.0 - - - attach-javadocs - - jar - - - @@ -349,12 +315,6 @@ 2.5 - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - org.apache.maven.plugins maven-eclipse-plugin @@ -405,31 +365,6 @@ - - maven-compiler-plugin - 3.7.0 - - ${source.version} - ${source.version} - true - true - - - - default-testCompile - process-test-sources - - testCompile - - - true - ${test.source.version} - ${test.source.version} - - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/redisson/src/main/java/org/redisson/BaseRemoteService.java b/redisson/src/main/java/org/redisson/BaseRemoteService.java index d9bfd376e..03c96369a 100644 --- a/redisson/src/main/java/org/redisson/BaseRemoteService.java +++ b/redisson/src/main/java/org/redisson/BaseRemoteService.java @@ -212,7 +212,7 @@ public abstract class BaseRemoteService { final RPromise responseFuture; if (optionsCopy.isResultExpected()) { - responseFuture = pollResponse(optionsCopy.getExecutionTimeoutInMillis(), requestId, false); + responseFuture = pollResultResponse(optionsCopy.getExecutionTimeoutInMillis(), requestId, request); } else { responseFuture = null; } @@ -360,6 +360,11 @@ public abstract class BaseRemoteService { }); } + protected RPromise pollResultResponse(long timeout, + RequestId requestId, RemoteServiceRequest request) { + return pollResponse(timeout, requestId, false); + } + private RPromise pollResponse(final long timeout, final RequestId requestId, boolean insertFirst) { final RPromise responseFuture = new RedissonPromise(); @@ -540,7 +545,7 @@ public abstract class BaseRemoteService { final RPromise responseFuture; if (optionsCopy.isResultExpected()) { - responseFuture = pollResponse(optionsCopy.getExecutionTimeoutInMillis(), requestId, false); + responseFuture = pollResultResponse(optionsCopy.getExecutionTimeoutInMillis(), requestId, request); } else { responseFuture = null; } diff --git a/redisson/src/main/java/org/redisson/RedissonExecutorService.java b/redisson/src/main/java/org/redisson/RedissonExecutorService.java index 5bcc6fcfe..c75084d61 100644 --- a/redisson/src/main/java/org/redisson/RedissonExecutorService.java +++ b/redisson/src/main/java/org/redisson/RedissonExecutorService.java @@ -99,7 +99,7 @@ public class RedissonExecutorService implements RScheduledExecutorService { private static final Logger LOGGER = LoggerFactory.getLogger(RedissonExecutorService.class); - private static final RemoteInvocationOptions RESULT_OPTIONS = RemoteInvocationOptions.defaults().noAck().expectResultWithin(1, TimeUnit.HOURS); + private static RemoteInvocationOptions RESULT_OPTIONS = RemoteInvocationOptions.defaults().noAck().expectResultWithin(1, TimeUnit.HOURS); public static final int SHUTDOWN_STATE = 1; public static final int TERMINATED_STATE = 2; diff --git a/redisson/src/main/java/org/redisson/executor/ScheduledTasksService.java b/redisson/src/main/java/org/redisson/executor/ScheduledTasksService.java index ac7199fd8..32aa5405f 100644 --- a/redisson/src/main/java/org/redisson/executor/ScheduledTasksService.java +++ b/redisson/src/main/java/org/redisson/executor/ScheduledTasksService.java @@ -27,6 +27,8 @@ import org.redisson.client.codec.StringCodec; import org.redisson.client.protocol.RedisCommands; import org.redisson.command.CommandExecutor; import org.redisson.executor.params.ScheduledParameters; +import org.redisson.misc.RPromise; +import org.redisson.remote.RRemoteServiceResponse; import org.redisson.remote.RemoteServiceRequest; import org.redisson.remote.RequestId; import org.redisson.remote.ResponseEntry; @@ -119,6 +121,17 @@ public class ScheduledTasksService extends TasksService { taskId.toString(), RedissonExecutorService.SHUTDOWN_STATE, RedissonExecutorService.TERMINATED_STATE); } + @Override + protected RPromise pollResultResponse(long timeout, RequestId requestId, + RemoteServiceRequest request) { + if (request.getArgs()[0].getClass() == ScheduledParameters.class) { + ScheduledParameters params = (ScheduledParameters) request.getArgs()[0]; + timeout += params.getStartTime() - System.currentTimeMillis(); + } + return super.pollResultResponse(timeout, requestId, request); + } + + @Override protected RequestId generateRequestId() { if (requestId == null) { diff --git a/redisson/src/main/java/org/redisson/misc/LogHelper.java b/redisson/src/main/java/org/redisson/misc/LogHelper.java index 5646c4fcd..08e94d694 100644 --- a/redisson/src/main/java/org/redisson/misc/LogHelper.java +++ b/redisson/src/main/java/org/redisson/misc/LogHelper.java @@ -43,8 +43,6 @@ public class LogHelper { return toArrayString(object); } else if (object instanceof Collection) { return toCollectionString((Collection) object); - } else if (object instanceof ByteBuf) { - return ((ByteBuf) object).toString(CharsetUtil.UTF_8); } else if (object instanceof CommandData) { CommandData cd = (CommandData)object; return cd.getCommand() + ", params: " + LogHelper.toString(cd.getParams()); diff --git a/redisson/src/test/java/org/redisson/executor/RedissonScheduledExecutorServiceTest.java b/redisson/src/test/java/org/redisson/executor/RedissonScheduledExecutorServiceTest.java index f8d2d65c9..54d8778bb 100644 --- a/redisson/src/test/java/org/redisson/executor/RedissonScheduledExecutorServiceTest.java +++ b/redisson/src/test/java/org/redisson/executor/RedissonScheduledExecutorServiceTest.java @@ -17,15 +17,18 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.redisson.BaseTest; +import org.redisson.RedissonExecutorService; import org.redisson.RedissonNode; import org.redisson.api.CronSchedule; import org.redisson.api.ExecutorOptions; import org.redisson.api.RExecutorFuture; import org.redisson.api.RScheduledExecutorService; import org.redisson.api.RScheduledFuture; +import org.redisson.api.RemoteInvocationOptions; import org.redisson.config.Config; import org.redisson.config.RedissonNodeConfig; +import mockit.Deencapsulation; import mockit.Invocation; import mockit.Mock; import mockit.MockUp; @@ -58,8 +61,27 @@ public class RedissonScheduledExecutorServiceTest extends BaseTest { long start = System.currentTimeMillis(); RScheduledFuture f = executor.schedule(new ScheduledCallableTask(), 11, TimeUnit.SECONDS); assertThat(f.awaitUninterruptibly(12000)).isTrue(); + assertThat(f.isSuccess()).isTrue(); assertThat(System.currentTimeMillis() - start).isBetween(11000L, 11500L); + Deencapsulation.setField(RedissonExecutorService.class, "RESULT_OPTIONS", RemoteInvocationOptions.defaults().noAck().expectResultWithin(3, TimeUnit.SECONDS)); + executor = redisson.getExecutorService("test", ExecutorOptions.defaults().taskRetryInterval(5, TimeUnit.SECONDS)); + start = System.currentTimeMillis(); + RScheduledFuture f1 = executor.schedule(new ScheduledCallableTask(), 5, TimeUnit.SECONDS); + assertThat(f1.awaitUninterruptibly(6000)).isTrue(); + assertThat(f1.isSuccess()).isTrue(); + assertThat(System.currentTimeMillis() - start).isBetween(5000L, 5500L); + + start = System.currentTimeMillis(); + RScheduledFuture f2 = executor.schedule(new RunnableTask(), 5, TimeUnit.SECONDS); + assertThat(f2.awaitUninterruptibly(6000)).isTrue(); + assertThat(f2.isSuccess()).isTrue(); + assertThat(System.currentTimeMillis() - start).isBetween(5000L, 5500L); + } + + @Test + public void testScheduleWithFixedDelay() throws InterruptedException { + RScheduledExecutorService executor = redisson.getExecutorService("test", ExecutorOptions.defaults().taskRetryInterval(5, TimeUnit.SECONDS)); executor.scheduleWithFixedDelay(new IncrementRunnableTask("counter"), 0, 7, TimeUnit.SECONDS); Thread.sleep(500); assertThat(redisson.getAtomicLong("counter").get()).isEqualTo(1);