|
|
-
Setting a deadline on an RPC?
Christophe Taton 2012-07-02, 19:21
Hi, Is there a way to set a deadline on an RPC? I've been searching the list and in the code but I didn't find anything so far. Thanks! C.
+
Christophe Taton 2012-07-02, 19:21
-
Re: Setting a deadline on an RPC?
Philip Zeyliger 2012-07-19, 01:19
Hi Christophe,
We do this:
private static <T> T createRpc(Class<T> klass, URL url, int timeoutMillis) throws IOException { HttpTransceiver transceiver = new HttpTransceiver(url); transceiver.setTimeout(timeoutMillis); SpecificRequestor requestor = new SpecificRequestor(klass, transceiver); T client = SpecificRequestor.getClient(klass, requestor); return client; } Cheers,
-- Philip On Mon, Jul 2, 2012 at 12:21 PM, Christophe Taton <[EMAIL PROTECTED]>wrote:
> Hi, > Is there a way to set a deadline on an RPC? > I've been searching the list and in the code but I didn't find anything so > far. > Thanks! > C. >
+
Philip Zeyliger 2012-07-19, 01:19
-
Re: Setting a deadline on an RPC?
Christophe Taton 2012-07-19, 18:41
Hey Philip,
On Wed, Jul 18, 2012 at 6:19 PM, Philip Zeyliger <[EMAIL PROTECTED]>wrote:
> Hi Christophe, > > We do this: > > private static <T> T createRpc(Class<T> klass, URL url, int > timeoutMillis) throws IOException { > HttpTransceiver transceiver = new HttpTransceiver(url); > transceiver.setTimeout(timeoutMillis); > SpecificRequestor requestor = new > SpecificRequestor(klass, transceiver); > T client = SpecificRequestor.getClient(klass, requestor); > return client; > } >
Thanks for the reply! Is there an equivalent with NettyTransceivers?
C. Cheers, > > -- Philip > > > On Mon, Jul 2, 2012 at 12:21 PM, Christophe Taton <[EMAIL PROTECTED]>wrote: > >> Hi, >> Is there a way to set a deadline on an RPC? >> I've been searching the list and in the code but I didn't find anything >> so far. >> Thanks! >> C. >> > >
+
Christophe Taton 2012-07-19, 18:41
-
Re: Setting a deadline on an RPC?
Doug Cutting 2012-07-19, 19:23
On Thu, Jul 19, 2012 at 11:41 AM, Christophe Taton <[EMAIL PROTECTED]> wrote: > Is there an equivalent with NettyTransceivers?
You might use the Callback API and use a CallFuture#await()?
Doug
+
Doug Cutting 2012-07-19, 19:23
-
Re: Setting a deadline on an RPC?
Philip Zeyliger 2012-07-19, 22:36
There are also constructors to NettyTransceiver that take timeout values for connections (this happens to be from 1.6.3):
/** * Creates a NettyTransceiver, and attempts to connect to the given address. * {@link #DEFAULT_CONNECTION_TIMEOUT_MILLIS} is used for the connection * timeout. * @param addr the address to connect to. * @throws IOException if an error occurs connecting to the given address. */ public NettyTransceiver(InetSocketAddress addr) throws IOException { this(addr, DEFAULT_CONNECTION_TIMEOUT_MILLIS); }
/** * Creates a NettyTransceiver, and attempts to connect to the given address. * @param addr the address to connect to. * @param connectTimeoutMillis maximum amount of time to wait for connection * establishment in milliseconds, or null to use * {@link #DEFAULT_CONNECTION_TIMEOUT_MILLIS}. * @throws IOException if an error occurs connecting to the given address. */ public NettyTransceiver(InetSocketAddress addr, Long connectTimeoutMillis) throws IOException { this(addr, new NioClientSocketChannelFactory( Executors.newCachedThreadPool(new NettyTransceiverThreadFactory( "Avro " + NettyTransceiver.class.getSimpleName() + " Boss")), Executors.newCachedThreadPool(new NettyTransceiverThreadFactory( "Avro " + NettyTransceiver.class.getSimpleName() + " I/O Worker"))), connectTimeoutMillis); }
On Thu, Jul 19, 2012 at 12:23 PM, Doug Cutting <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 19, 2012 at 11:41 AM, Christophe Taton <[EMAIL PROTECTED]> > wrote: > > Is there an equivalent with NettyTransceivers? > > You might use the Callback API and use a CallFuture#await()? > > Doug >
+
Philip Zeyliger 2012-07-19, 22:36
|
|