Skip to content

Commit

Permalink
Merge pull request #338 from benjchristensen/api-design
Browse files Browse the repository at this point in the history
API Changes as per Design Review
  • Loading branch information
benjchristensen committed Dec 11, 2014
2 parents cfa3ae1 + b223782 commit 3b4ef6c
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 7,722 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import com.netflix.hystrix.util.HystrixTimer;
import com.netflix.hystrix.util.HystrixTimer.TimerListener;

/* package */abstract class AbstractCommand<R> implements HystrixExecutableInfo<R>, HystrixObservable<R> {
/* package */abstract class AbstractCommand<R> implements HystrixInvokableInfo<R>, HystrixObservable<R> {
// TODO make this package private

private static final Logger logger = LoggerFactory.getLogger(AbstractCommand.class);
Expand Down Expand Up @@ -1146,7 +1146,7 @@ public AbstractCommand<R> getCommand() {
}

/**
* @return {@link HystrixCommandGroupKey} used to group together multiple {@link HystrixAsyncCommand} objects.
* @return {@link HystrixCommandGroupKey} used to group together multiple {@link HystrixFutureCommand} objects.
* <p>
* The {@link HystrixCommandGroupKey} is used to represent a common relationship between commands. For example, a library or team name, the system all related commands interace with,
* common business purpose etc.
Expand Down Expand Up @@ -1175,7 +1175,7 @@ public HystrixThreadPoolKey getThreadPoolKey() {
}

/**
* The {@link HystrixCommandMetrics} associated with this {@link HystrixAsyncCommand} instance.
* The {@link HystrixCommandMetrics} associated with this {@link HystrixFutureCommand} instance.
*
* @return HystrixCommandMetrics
*/
Expand All @@ -1184,7 +1184,7 @@ public HystrixCommandMetrics getMetrics() {
}

/**
* The {@link HystrixCommandProperties} associated with this {@link HystrixAsyncCommand} instance.
* The {@link HystrixCommandProperties} associated with this {@link HystrixFutureCommand} instance.
*
* @return HystrixCommandProperties
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*
* @ThreadSafe
*/
public abstract class HystrixCommand<R> extends AbstractCommand<R> implements HystrixExecutable<R>, HystrixExecutableInfo<R>, HystrixObservable<R> {
public abstract class HystrixCommand<R> extends AbstractCommand<R> implements HystrixExecutable<R>, HystrixInvokableInfo<R>, HystrixObservable<R> {

/**
* Construct a {@link HystrixCommand} with defined {@link HystrixCommandGroupKey}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.List;

public interface HystrixExecutableInfo<R> {
public interface HystrixInvokableInfo<R> {

public HystrixCommandGroupKey getCommandGroup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
* @ThreadSafe
*/
public abstract class HystrixObservableCommand<R> extends AbstractCommand<R> implements HystrixObservable<R>, HystrixExecutableInfo<R> {
public abstract class HystrixObservableCommand<R> extends AbstractCommand<R> implements HystrixObservable<R>, HystrixInvokableInfo<R> {

/**
* Construct a {@link HystrixObservableCommand} with defined {@link HystrixCommandGroupKey}.
Expand Down Expand Up @@ -205,7 +205,7 @@ private HystrixCommandProperties.Setter setDefaults(HystrixCommandProperties.Set
*
* @return R or UnsupportedOperationException if not implemented
*/
protected Observable<R> onFailureResumeWithFallback() {
protected Observable<R> resumeWithFallback() {
return Observable.error(new UnsupportedOperationException("No fallback available."));
}

Expand All @@ -216,6 +216,6 @@ final protected Observable<R> getExecutionObservable() {

@Override
final protected Observable<R> getFallbackObservable() {
return onFailureResumeWithFallback();
return resumeWithFallback();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public void shutdown(HystrixRequestLog value) {
private LinkedBlockingQueue<HystrixCommand<?>> executedCommands = new LinkedBlockingQueue<HystrixCommand<?>>(MAX_STORAGE);

/**
* History of {@link HystrixExecutableInfo} executed in this request.
* History of {@link HystrixInvokableInfo} executed in this request.
*/
private LinkedBlockingQueue<HystrixExecutableInfo<?>> allExecutedCommands = new LinkedBlockingQueue<HystrixExecutableInfo<?>>(MAX_STORAGE);
private LinkedBlockingQueue<HystrixInvokableInfo<?>> allExecutedCommands = new LinkedBlockingQueue<HystrixInvokableInfo<?>>(MAX_STORAGE);

// prevent public instantiation
private HystrixRequestLog() {
Expand Down Expand Up @@ -112,7 +112,7 @@ public Collection<HystrixCommand<?>> getExecutedCommands() {
*
* @return {@code Collection<HystrixCommand<?>>}
*/
public Collection<HystrixExecutableInfo<?>> getAllExecutedCommands() {
public Collection<HystrixInvokableInfo<?>> getAllExecutedCommands() {
return Collections.unmodifiableCollection(allExecutedCommands);
}

Expand All @@ -122,7 +122,7 @@ public Collection<HystrixExecutableInfo<?>> getAllExecutedCommands() {
* @param command
* {@code HystrixCommand<?>}
*/
/* package */void addExecutedCommand(HystrixExecutableInfo<?> command) {
/* package */void addExecutedCommand(HystrixInvokableInfo<?> command) {
if (!allExecutedCommands.offer(command)) {
// see RequestLog: Reduce Chance of Memory Leak https://github.com/Netflix/Hystrix/issues/53
logger.warn("RequestLog ignoring command after reaching limit of " + MAX_STORAGE + ". See https://github.com/Netflix/Hystrix/issues/53 for more information.");
Expand Down Expand Up @@ -169,7 +169,7 @@ public String getExecutedCommandsAsString() {

StringBuilder builder = new StringBuilder();
int estimatedLength = 0;
for (HystrixExecutableInfo<?> command : allExecutedCommands) {
for (HystrixInvokableInfo<?> command : allExecutedCommands) {
builder.setLength(0);
builder.append(command.getCommandKey().name());

Expand Down
Loading

0 comments on commit 3b4ef6c

Please sign in to comment.