Author: davsclaus
Date: Thu Aug 26 08:02:07 2010
New Revision: 989516

URL: http://svn.apache.org/viewvc?rev=989516&view=rev
Log:
CAMEL-3081: Removed timeout option as it was flawed.

Removed:
    
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyExchangeTimeoutTest.java
Modified:
    
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
    
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
    
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
    
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
    
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java
    
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java

Modified: 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java?rev=989516&r1=989515&r2=989516&view=diff
==============================================================================
--- 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
 (original)
+++ 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
 Thu Aug 26 08:02:07 2010
@@ -17,7 +17,6 @@
 package org.apache.camel.component.netty;
 
 import java.util.List;
-import java.util.concurrent.TimeUnit;
 import javax.net.ssl.SSLEngine;
 
 import org.apache.camel.AsyncCallback;
@@ -31,7 +30,6 @@ import org.jboss.netty.channel.ChannelPi
 import org.jboss.netty.channel.ChannelUpstreamHandler;
 import org.jboss.netty.channel.Channels;
 import org.jboss.netty.handler.ssl.SslHandler;
-import org.jboss.netty.handler.timeout.ReadTimeoutHandler;
 
 public class DefaultClientPipelineFactory extends ClientPipelineFactory {
     private static final transient Log LOG = 
LogFactory.getLog(ClientPipelineFactory.class);
@@ -52,11 +50,6 @@ public class DefaultClientPipelineFactor
             channelPipeline.addLast("ssl", sslHandler);
         }
 
-        // use read timeout handler to handle timeout while waiting for a 
remote reply (while reading from the remote host)
-        if (producer.getConfiguration().getTimeout() > 0) {
-            channelPipeline.addLast("timeout", new 
ReadTimeoutHandler(producer.getEndpoint().getTimer(), 
producer.getConfiguration().getTimeout(), TimeUnit.MILLISECONDS));
-        }
-
         List<ChannelUpstreamHandler> decoders = 
producer.getConfiguration().getDecoders();
         for (int x = 0; x < decoders.size(); x++) {
             channelPipeline.addLast("decoder-" + x, decoders.get(x));

Modified: 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java?rev=989516&r1=989515&r2=989516&view=diff
==============================================================================
--- 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
 (original)
+++ 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
 Thu Aug 26 08:02:07 2010
@@ -50,7 +50,6 @@ public class NettyConfiguration implemen
     private boolean tcpNoDelay = true;
     private boolean broadcast;
     private long connectTimeout = 10000;
-    private long timeout = 30000;
     private boolean reuseAddress = true;
     private boolean sync = true;
     private boolean textline;
@@ -329,14 +328,6 @@ public class NettyConfiguration implemen
         this.decoders = decoders;
     }
 
-    public long getTimeout() {
-        return timeout;
-    }
-
-    public void setTimeout(long timeout) {
-        this.timeout = timeout;
-    }
-
     public long getSendBufferSize() {
         return sendBufferSize;
     }

Modified: 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java?rev=989516&r1=989515&r2=989516&view=diff
==============================================================================
--- 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
 (original)
+++ 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
 Thu Aug 26 08:02:07 2010
@@ -19,7 +19,6 @@ package org.apache.camel.component.netty
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
-import org.apache.camel.ExchangeTimedOutException;
 import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.component.netty.NettyConstants;
 import org.apache.camel.component.netty.NettyHelper;
@@ -33,7 +32,6 @@ import org.jboss.netty.channel.ChannelSt
 import org.jboss.netty.channel.ExceptionEvent;
 import org.jboss.netty.channel.MessageEvent;
 import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
-import org.jboss.netty.handler.timeout.TimeoutException;
 
 /**
  * Client handler which cannot be shared
@@ -73,26 +71,17 @@ public class ClientChannelHandler extend
         exceptionHandled = true;
         Throwable cause = exceptionEvent.getCause();
 
-        // was it the timeout
-        if (cause instanceof TimeoutException) {
-            // timeout occurred
-            exchange.setException(new ExchangeTimedOutException(exchange, 
producer.getConfiguration().getTimeout()));
-
-            // signal callback
-            callback.done(false);
-        } else {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Closing channel as an exception was thrown from 
Netty", cause);
-            }
-            // set the cause on the exchange
-            exchange.setException(cause);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Closing channel as an exception was thrown from Netty", 
cause);
+        }
+        // set the cause on the exchange
+        exchange.setException(cause);
 
-            // close channel in case an exception was thrown
-            NettyHelper.close(exceptionEvent.getChannel());
+        // close channel in case an exception was thrown
+        NettyHelper.close(exceptionEvent.getChannel());
 
-            // signal callback
-            callback.done(false);
-        }
+        // signal callback
+        callback.done(false);
     }
 
     @Override

Modified: 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java?rev=989516&r1=989515&r2=989516&view=diff
==============================================================================
--- 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
 (original)
+++ 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
 Thu Aug 26 08:02:07 2010
@@ -29,7 +29,6 @@ public class NettyComponentWithConfigura
         NettyComponent comp = context.getComponent("netty", 
NettyComponent.class);
 
         NettyConfiguration cfg = new NettyConfiguration();
-        cfg.setTimeout(15000);
 
         comp.setConfiguration(cfg);
         assertSame(cfg, comp.getConfiguration());
@@ -45,8 +44,6 @@ public class NettyComponentWithConfigura
 
         assertEquals(true, e1.getConfiguration().isSync());
         assertEquals(false, e2.getConfiguration().isSync());
-        assertEquals(15000, e1.getConfiguration().getTimeout());
-        assertEquals(15000, e2.getConfiguration().getTimeout());
         assertEquals(4455, e1.getConfiguration().getPort());
         assertEquals(5566, e2.getConfiguration().getPort());
     }

Modified: 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java?rev=989516&r1=989515&r2=989516&view=diff
==============================================================================
--- 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java
 (original)
+++ 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java
 Thu Aug 26 08:02:07 2010
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.component.netty;
 
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Produce;
@@ -30,15 +27,12 @@ import org.apache.camel.impl.JndiRegistr
 import org.apache.camel.test.CamelTestSupport;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.netty.channel.ChannelDownstreamHandler;
 import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.channel.ChannelUpstreamHandler;
 import org.jboss.netty.channel.Channels;
 import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
 import org.jboss.netty.handler.codec.frame.Delimiters;
 import org.jboss.netty.handler.codec.string.StringDecoder;
 import org.jboss.netty.handler.codec.string.StringEncoder;
-import org.jboss.netty.handler.timeout.ReadTimeoutHandler;
 import org.jboss.netty.util.CharsetUtil;
 import org.junit.Test;
 
@@ -110,18 +104,12 @@ public class NettyCustomPipelineFactoryS
             
             ChannelPipeline channelPipeline = Channels.pipeline();
 
-            // In Sync mode,adding a read timeout handler to handle timeout 
while waiting for a remote reply
-            if (producer.getConfiguration().getTimeout() > 0) {
-                channelPipeline.addLast("timeout", new 
ReadTimeoutHandler(producer.getEndpoint().getTimer(), 
producer.getConfiguration().getTimeout(), TimeUnit.MILLISECONDS));
-            }
-
             channelPipeline.addLast("decoder-DELIM", new 
DelimiterBasedFrameDecoder(maxLineSize, true, Delimiters.lineDelimiter()));
             channelPipeline.addLast("decoder-SD", new 
StringDecoder(CharsetUtil.UTF_8));
             channelPipeline.addLast("encoder-SD", new 
StringEncoder(CharsetUtil.UTF_8));            
             channelPipeline.addLast("handler", new 
ClientChannelHandler(producer, exchange, callback));
 
             return channelPipeline;
-
         }
         
         public boolean isfactoryInvoked() {
@@ -149,7 +137,7 @@ public class NettyCustomPipelineFactoryS
         public boolean isfactoryInvoked() {
             return invoked;
         }
-        
     }
+
 }
 

Modified: 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java?rev=989516&r1=989515&r2=989516&view=diff
==============================================================================
--- 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java
 (original)
+++ 
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java
 Thu Aug 26 08:02:07 2010
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.netty;
 
-import org.apache.camel.ExchangeTimedOutException;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
@@ -43,16 +42,6 @@ public class NettyInOutWithForcedNoRespo
         }
     }
 
-    @Test
-    public void testNoResponseDisconnectOnNoReplyFalse() throws Exception {
-        try {
-            
template.requestBody("netty:tcp://localhost:4445?sync=true&timeout=3000", 
"London");
-            fail("Should throw an exception");
-        } catch (RuntimeCamelException e) {
-            assertIsInstanceOf(ExchangeTimedOutException.class, e.getCause());
-        }
-    }
-
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {


Reply via email to