Configuring timeout for scalaxb

161 views
Skip to first unread message

Joe Barnes

unread,
Jan 27, 2015, 11:59:47 AM1/27/15
to sca...@googlegroups.com
I've been trying to figure out how to configure our timeout with scalaxb, but thus far I haven't had success.  We're using sbt-scalaxb 1.1.2 plugin to generate our code.  We've been playing with the generated code for creating the dispatch Http client, but this hasn't worked.  Below is our latest swing at it:

trait SpecialHttpClients extends HttpClients {
   lazy val httpClient = new DispatchHttpClient {}

   trait DispatchHttpClient extends HttpClient {
     import dispatch._, Defaults._
     val http = Http.configure(_.setRequestTimeoutInMs(10000).setConnectionTimeoutInMs(10000))

     def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
       val req = url(address.toString) << in <:< headers
       val s = http(req > as.String)
       s()
     }
   }
}




We've also played with some of the other timeout parameters as well, such as the idle connection.  So far nothing seems to work.  Below is the call stack we get when we get the error, if that provides any hints.

I know this isn't really a scalaxb question, but I'm hopeful someone here knows the answer.  I've been digging around dispatch, asynch-http-client, and netty hoping to figure out where our disconnect is.  Thanks in advance to anyone who has some guidance to get me on the right track.

Joe


[ERROR] [01/26/2015 11:56:34.378]
[Mentor-Portal-akka.actor.default-dispatcher-17] [akka://Mentor-Portal/user/$d/$c] java.net.ConnectException: 
connection timed out: servicestest.digikey.com/23.48.158.130:443 to https://servicestest.digikey.co m/dkservices/Service.svc/soap
java.util.concurrent.ExecutionException: java.net.ConnectException: 
         at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:342)
         at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:107)
         at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:431)
         at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:422)
         at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:384)
         at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:142)
         at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)
         at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
         at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
         at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
         at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
         at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: connection timed out: 
         at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:103)
         ... 12 more
Caused by: org.jboss.netty.channel.ConnectTimeoutException: connection timed out:
         at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:139)
         ... 8 more



eugene yokota

unread,
Jan 28, 2015, 3:23:22 AM1/28/15
to sca...@googlegroups.com
Hi Joe,

I added a TimeoutTest to check if timeouts work.
It seems to work ok for me at least for the request timeout - https://github.com/eed3si9n/scalaxb/pull/304

-eugene
Reply all
Reply to author
Forward
0 new messages