Skip to content

Commit

Permalink
Merge pull request #254 from benjchristensen/remove-jsr305-dependency
Browse files Browse the repository at this point in the history
Remove jsr305 Dependency
  • Loading branch information
benjchristensen committed Apr 30, 2014
2 parents 2972125 + 00d8ecb commit a3724bc
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 51 deletions.
3 changes: 2 additions & 1 deletion hystrix-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencies {
compile 'com.netflix.archaius:archaius-core:0.4.1'
compile 'com.netflix.rxjava:rxjava-core:0.18.1'
compile 'org.slf4j:slf4j-api:1.7.0'
compile 'com.google.code.findbugs:jsr305:2.0.0'
testCompile 'junit:junit-dep:4.10'
}

Expand All @@ -25,6 +24,8 @@ javadoc {
options.addStringOption('top').value = '<a href="https://github.com/Netflix/Hystrix"><img width="92" height="79" border="0" align="left" src="http://netflix.github.com/Hystrix/images/hystrix-logo-small.png"></a><h2 class="title" style="padding-top:40px">Hystrix: Latency and Fault Tolerance for Distributed Systems</h2>'
}

// skip if not on Java 6 (every JDK changes Javadoc behavior)
javadoc.onlyIf { JavaVersion.current().java6 }

eclipse {
classpath {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;

import javax.annotation.concurrent.ThreadSafe;

import com.netflix.hystrix.HystrixCommandMetrics.HealthCounts;

/**
Expand Down Expand Up @@ -53,8 +51,8 @@ public interface HystrixCircuitBreaker {

/**
* @ExcludeFromJavadoc
* @ThreadSafe
*/
@ThreadSafe
public static class Factory {
// String is HystrixCommandKey.name() (we can't use HystrixCommandKey directly as we can't guarantee it implements hashcode/equals correctly)
private static ConcurrentHashMap<String, HystrixCircuitBreaker> circuitBreakersByCommand = new ConcurrentHashMap<String, HystrixCircuitBreaker>();
Expand Down Expand Up @@ -120,8 +118,8 @@ public static HystrixCircuitBreaker getInstance(HystrixCommandKey key) {
* The default production implementation of {@link HystrixCircuitBreaker}.
*
* @ExcludeFromJavadoc
* @ThreadSafe
*/
@ThreadSafe
/* package */static class HystrixCircuitBreakerImpl implements HystrixCircuitBreaker {
private final HystrixCommandProperties properties;
private final HystrixCommandMetrics metrics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;

import javax.annotation.concurrent.NotThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -504,8 +502,9 @@ public interface CollapsedRequest<ResponseType, RequestArgumentType> {
* Setter.withCollapserKey(HystrixCollapserKey.Factory.asKey("CollapserName"))
.andScope(Scope.REQUEST);
* } </pre>
*
* @NotThreadSafe
*/
@NotThreadSafe
public static class Setter {
private final HystrixCollapserKey collapserKey;
private Scope scope = Scope.REQUEST; // default if nothing is set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

import static com.netflix.hystrix.strategy.properties.HystrixProperty.Factory.*;

import javax.annotation.concurrent.NotThreadSafe;

import com.netflix.hystrix.strategy.properties.HystrixPropertiesChainedArchaiusProperty;
import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy;
import com.netflix.hystrix.strategy.properties.HystrixProperty;
Expand Down Expand Up @@ -118,8 +116,9 @@ public static Setter Setter() {
* .setMaxRequestsInBatch(100)
* .setTimerDelayInMilliseconds(10);
* } </pre>
*
* @NotThreadSafe
*/
@NotThreadSafe
public static class Setter {
private Boolean collapsingEnabled = null;
private Integer maxRequestsInBatch = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
import java.util.List;
import java.util.concurrent.Future;

import javax.annotation.concurrent.NotThreadSafe;
import javax.annotation.concurrent.ThreadSafe;

import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Scheduler;
Expand All @@ -42,8 +39,9 @@
*
* @param <R>
* the return type
*
* @ThreadSafe
*/
@ThreadSafe
public abstract class HystrixCommand<R> implements HystrixExecutable<R>, HystrixExecutableInfo<R> {

private final HystrixCommandFromObservableCommand<R> observableCommand;
Expand Down Expand Up @@ -120,8 +118,9 @@ protected HystrixCommand(Setter setter) {
.andCommandKey(HystrixCommandKey.Factory.asKey("CommandName"))
.andEventNotifier(notifier);
* } </pre>
*
* @NotThreadSafe
*/
@NotThreadSafe
public static class Setter {

protected final HystrixCommandGroupKey groupKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import java.util.concurrent.Future;

import javax.annotation.concurrent.NotThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -469,8 +467,9 @@ public static Setter Setter() {
* .setExecutionTimeoutInMilliseconds(100)
* .setExecuteCommandOnSeparateThread(true);
* } </pre>
*
* @NotThreadSafe
*/
@NotThreadSafe
public static class Setter {

private Boolean circuitBreakerEnabled = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;

import javax.annotation.concurrent.NotThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -474,8 +472,9 @@ private static String getDefaultNameFromClass(@SuppressWarnings("rawtypes") Clas
* Setter.withCollapserKey(HystrixCollapserKey.Factory.asKey("CollapserName"))
.andScope(Scope.REQUEST);
* } </pre>
*
* @NotThreadSafe
*/
@NotThreadSafe
public static class Setter {
private final HystrixCollapserKey collapserKey;
private Scope scope = Scope.REQUEST; // default if nothing is set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;

import javax.annotation.concurrent.NotThreadSafe;
import javax.annotation.concurrent.ThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -58,8 +55,9 @@
*
* @param <R>
* the return type
*
* @ThreadSafe
*/
@ThreadSafe
public abstract class HystrixObservableCommand<R> extends HystrixExecutableBase<R> implements HystrixExecutable<R>, HystrixExecutableInfo<R> {

private static final Logger logger = LoggerFactory.getLogger(HystrixObservableCommand.class);
Expand Down Expand Up @@ -123,8 +121,9 @@ protected HystrixObservableCommand(Setter setter) {
.andCommandKey(HystrixCommandKey.Factory.asKey("CommandName"))
.andEventNotifier(notifier);
* } </pre>
*
* @NotThreadSafe
*/
@NotThreadSafe
public static class Setter {

protected final HystrixCommandGroupKey groupKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import javax.annotation.concurrent.ThreadSafe;

import rx.Scheduler;

import com.netflix.hystrix.strategy.HystrixPlugins;
Expand Down Expand Up @@ -157,8 +155,8 @@ public interface HystrixThreadPool {

/**
* @ExcludeFromJavadoc
* @ThreadSafe
*/
@ThreadSafe
/* package */static class HystrixThreadPoolDefault implements HystrixThreadPool {
private final HystrixThreadPoolProperties properties;
private final BlockingQueue<Runnable> queue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import javax.annotation.concurrent.NotThreadSafe;

import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
import com.netflix.hystrix.strategy.properties.HystrixPropertiesChainedArchaiusProperty;
import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy;
Expand Down Expand Up @@ -166,8 +164,9 @@ public static Setter Setter() {
* .setCoreSize(10)
* .setQueueSizeRejectionThreshold(10);
* } </pre>
*
* @NotThreadSafe
*/
@NotThreadSafe
public static class Setter {
private Integer coreSize = null;
private Integer keepAliveTimeMinutes = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;

import javax.annotation.concurrent.ThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -24,8 +22,9 @@
* Instances of this are retrieved from the RequestCollapserFactory.
*
* Must be thread-safe since it exists within a RequestVariable which is request-scoped and can be accessed from multiple threads.
*
* @ThreadSafe
*/
@ThreadSafe
public class RequestCollapser<BatchReturnType, ResponseType, RequestArgumentType> {
static final Logger logger = LoggerFactory.getLogger(HystrixCollapser.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.concurrent.ConcurrentHashMap;

import javax.annotation.concurrent.NotThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -215,8 +213,9 @@ public void shutdown(RequestCollapser<BatchReturnType, ResponseType, RequestArgu
* Setter.withCollapserKey(HystrixCollapserKey.Factory.asKey("CollapserName"))
.andScope(Scope.REQUEST);
* } </pre>
*
* @NotThreadSafe
*/
@NotThreadSafe
public static class Setter {
private final HystrixCollapserKey collapserKey;
private Scope scope = Scopes.REQUEST; // default if nothing is set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

import java.util.concurrent.ConcurrentHashMap;

import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -55,8 +52,8 @@
* Example 2: {@code HystrixRequestVariable<PojoThatIsThreadSafe>}
*
* @ExcludeFromJavadoc
* @ThreadSafe
*/
@ThreadSafe
public class HystrixRequestVariableDefault<T> implements HystrixRequestVariable<T> {
static final Logger logger = LoggerFactory.getLogger(HystrixRequestVariableDefault.class);

Expand Down Expand Up @@ -188,14 +185,14 @@ public void shutdown(T value) {
* @param <T>
*/
/* package */static final class LazyInitializer<T> {
@GuardedBy("synchronization on get() or construction")
// @GuardedBy("synchronization on get() or construction")
private T value;

/*
* Boolean to ensure only-once initialValue() execution instead of using
* a null check in case initialValue() returns null
*/
@GuardedBy("synchronization on get() or construction")
// @GuardedBy("synchronization on get() or construction")
private boolean initialized = false;

private final HystrixRequestVariableDefault<T> rv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.locks.ReentrantLock;

import javax.annotation.concurrent.ThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -45,8 +43,9 @@
* ensure the sum is up-to-date when the read can easily iterate each bucket to get the sum when it needs it.
* <p>
* See UnitTest for usage and expected behavior examples.
*
* @ThreadSafe
*/
@ThreadSafe
public class HystrixRollingNumber {
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(HystrixRollingNumber.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.locks.ReentrantLock;

import javax.annotation.concurrent.NotThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -313,7 +311,9 @@ public int length() {

}

@NotThreadSafe
/**
* @NotThreadSafe
*/
/* package for testing */ static class PercentileSnapshot {
private final int[] data;
private final int length;
Expand Down

0 comments on commit a3724bc

Please sign in to comment.