FetchObject has a timeout method -

/**

     * Set an operation timeout in milliseconds to be sent to Riak

     * 

     * As of 1.4 Riak allows a timeout to be sent for get, put, and delete
operations. 

     * The client will receive a timeout error if the operation is not
completed 

     * within the specified time

     * @param timeout the timeout in milliseconds 

     * @return this

     */

    

    public FetchObject<T> timeout(int timeout) {

        builder.timeout(timeout);

        return this;

    }

 

But it doesn't work, I am using as following 

 

FetchObject<IRiakObject> fo= xBucket.fetch("0.10717155098162867");

 

IRiakObject iRiakObject =fo.timeout(1).execute();

 

Other timeouts like ConnectionTimeout and RequestTimeout work perfect but
timeout on fetch object with execute has no effect in my case it takes 31
miliseconds to fetch and I have a timeout of 1 ms but I see no error., What
I am missing here?

 

FYI, I am making client as per following -

 

       private static IRiakClient setupRiakClusterClient() {

              IRiakClient client = null;

              try {

                     String riakClusteHost2 = "10.200.2.58";

 

                     int riakClusterPort = 8087;

 

                     int riakIntialPoolSize = 10;

                     int riakMaxPoolSize = 200;

                     int riakConnectionTimeoutMillis = 10;

                     int riakRequestTimeoutMillis = 2;

 

                     PBClusterConfig clusterConfig = new
PBClusterConfig(riakMaxPoolSize);

                     PBClientConfig pbconfig = new
PBClientConfig.Builder().withPort(riakClusterPort).withInitialPoolSize(riakI
ntialPoolSize).withPoolSize(riakMaxPoolSize).withConnectionTimeoutMillis(ria
kConnectionTimeoutMillis).withRequestTimeoutMillis(riakRequestTimeoutMillis)
.withIdleConnectionTTLMillis(1).build();

 

                     clusterConfig.addHosts(pbconfig, riakClusteHost2);

                     client = RiakFactory.newClient(clusterConfig);

 

              } catch (RiakException e) {

                     e.printStackTrace();

                     System.exit(1);

              }

              return client;

       }

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to