polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [5/5] zest-java git commit: remove core/io usage from tests & helpers in libraries & extensions
Date Mon, 28 Nov 2016 18:27:29 GMT
remove core/io usage from tests & helpers in libraries & extensions


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/dc30f4b4
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/dc30f4b4
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/dc30f4b4

Branch: refs/heads/develop
Commit: dc30f4b41497087280ac734d2285123bf2f1f398
Parents: 1a9f685
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon Nov 28 19:27:06 2016 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Nov 28 19:27:06 2016 +0100

----------------------------------------------------------------------
 .../library/circuitbreaker/CircuitBreakers.java | 45 --------------------
 1 file changed, 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/dc30f4b4/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/CircuitBreakers.java
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/CircuitBreakers.java
b/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/CircuitBreakers.java
index 5ef0af3..e334635 100644
--- a/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/CircuitBreakers.java
+++ b/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/CircuitBreakers.java
@@ -20,57 +20,12 @@
 package org.apache.zest.library.circuitbreaker;
 
 import java.util.function.Predicate;
-import org.apache.zest.io.Output;
-import org.apache.zest.io.Receiver;
-import org.apache.zest.io.Sender;
 
 /**
  * CircuitBreaker helper methods.
  */
 public class CircuitBreakers
 {
-   public static <Item, ReceiverThrowable extends Throwable> Output<Item, ReceiverThrowable>
withBreaker( final CircuitBreaker breaker, final Output<Item, ReceiverThrowable> output)
-   {
-      return new Output<Item, ReceiverThrowable>()
-      {
-         @Override
-         public <SenderThrowableType extends Throwable> void receiveFrom(final Sender<?
extends Item, SenderThrowableType> sender) throws ReceiverThrowable, SenderThrowableType
-         {
-            output.receiveFrom( new Sender<Item, SenderThrowableType>()
-            {
-               @Override
-               public <ReceiverThrowableType extends Throwable> void sendTo(final Receiver<?
super Item, ReceiverThrowableType> receiver) throws ReceiverThrowableType, SenderThrowableType
-               {
-                  // Check breaker first
-                  if (!breaker.isOn())
-                     throw (ReceiverThrowableType) breaker.lastThrowable();
-
-                  sender.sendTo( new Receiver<Item, ReceiverThrowableType>()
-                  {
-                     @Override
-                     public void receive( Item item ) throws ReceiverThrowableType
-                     {
-                        try
-                        {
-                           receiver.receive( item );
-
-                           // Notify breaker that it went well
-                           breaker.success();
-                        } catch (Throwable receiverThrowableType)
-                        {
-                           // Notify breaker of trouble
-                           breaker.throwable( receiverThrowableType );
-
-                           throw (ReceiverThrowableType) receiverThrowableType;
-                        }
-                     }
-                  });
-               }
-            });
-         }
-      };
-   }
-
    /**
     * Allow all throwables that are equal to or subclasses of given list of throwables.
     *


Mime
View raw message