Skip to content

Commit

Permalink
Moved Scheduler and Schedulers to the .util.concurrent package.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalterman committed Apr 1, 2016
1 parent 88c8a02 commit 09aa214
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
@@ -1,9 +1,14 @@
# 0.5.1

### New Features

* Added `RetryPolicy.abortOn`, `abortWhen` and `abortIf` methods to abort retries when matched.

### API Changes

* `RetryPolicy.retryWhen` was renamed to `retryIf` for retrying if a `Predicate` is matched.
* `RetryPolicy.retryFor` was renamed to `retryWhen` for retrying when a result is matched.
* `Scheduler` and `Schedulers` were moved to `net.jodah.recurrent.util.concurrent`.

# 0.5.0

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -112,6 +112,7 @@
<configuration>
<author>false</author>
<show>public</show>
<excludePackageNames>*.internal</excludePackageNames>
<additionalparam>
-Xdoclint:none
-notimestamp
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/jodah/recurrent/AsyncInvocation.java
Expand Up @@ -4,6 +4,7 @@
import java.util.concurrent.TimeUnit;

import net.jodah.recurrent.internal.util.Assert;
import net.jodah.recurrent.util.concurrent.Scheduler;

/**
* Tracks asynchronous invocations and allows retries to be scheduled according to a {@link RetryPolicy}.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/jodah/recurrent/AsyncListeners.java
Expand Up @@ -8,6 +8,7 @@
import net.jodah.recurrent.event.ContextualResultListener;
import net.jodah.recurrent.event.ResultListener;
import net.jodah.recurrent.internal.util.Assert;
import net.jodah.recurrent.util.concurrent.Scheduler;

/**
* Recurrent event listeners that are called asynchronously on the {@link Scheduler} or {@link ScheduledExecutorService}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/jodah/recurrent/InvocationStats.java
@@ -1,7 +1,7 @@
package net.jodah.recurrent;

/**
* Retry statistics.
* Invocation statistics.
*
* @author Jonathan Halterman
*/
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/jodah/recurrent/Recurrent.java
Expand Up @@ -6,6 +6,8 @@
import java.util.concurrent.TimeUnit;

import net.jodah.recurrent.internal.util.Assert;
import net.jodah.recurrent.util.concurrent.Scheduler;
import net.jodah.recurrent.util.concurrent.Schedulers;

/**
* Performs invocations with synchronous or asynchronous retries according to a {@link RetryPolicy}. Asynchronous
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/jodah/recurrent/RecurrentFuture.java
Expand Up @@ -14,6 +14,7 @@
import net.jodah.recurrent.event.SuccessListener;
import net.jodah.recurrent.internal.util.Assert;
import net.jodah.recurrent.internal.util.concurrent.ReentrantCircuit;
import net.jodah.recurrent.util.concurrent.Scheduler;

/**
* A future result of an asynchronous operation.
Expand Down
Expand Up @@ -13,36 +13,57 @@
* @param <T> result type
*/
public class DefaultScheduledFuture<T> implements ScheduledFuture<T> {
/**
* @return {@code 0}
*/
@Override
public long getDelay(TimeUnit unit) {
return 0;
}

/**
* @return {@code 0}
*/
@Override
public int compareTo(Delayed o) {
return 0;
}

/**
* @return {@code false}
*/
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}

/**
* @return {@code false}
*/
@Override
public boolean isCancelled() {
return false;
}

/**
* @return {@code false}
*/
@Override
public boolean isDone() {
return false;
}

/**
* @return {@code null}
*/
@Override
public T get() throws InterruptedException, ExecutionException {
return null;
}

/**
* @return {@code null}
*/
@Override
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return null;
Expand Down
@@ -1,4 +1,4 @@
package net.jodah.recurrent;
package net.jodah.recurrent.util.concurrent;

import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledFuture;
Expand Down
@@ -1,4 +1,4 @@
package net.jodah.recurrent;
package net.jodah.recurrent.util.concurrent;

import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledExecutorService;
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/net/jodah/recurrent/AsyncInvocationTest.java
Expand Up @@ -14,6 +14,8 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import net.jodah.recurrent.util.concurrent.Scheduler;

@Test
public class AsyncInvocationTest {
ConnectException e = new ConnectException();
Expand Down
Expand Up @@ -8,8 +8,8 @@
import io.vertx.core.eventbus.ReplyFailure;
import net.jodah.recurrent.Recurrent;
import net.jodah.recurrent.RetryPolicy;
import net.jodah.recurrent.Scheduler;
import net.jodah.recurrent.util.concurrent.DefaultScheduledFuture;
import net.jodah.recurrent.util.concurrent.Scheduler;

public class VertxExample {
static Vertx vertx = Vertx.vertx();
Expand Down

0 comments on commit 09aa214

Please sign in to comment.