Example usage for org.apache.thrift.transport THttpClient setReadTimeout

List of usage examples for org.apache.thrift.transport THttpClient setReadTimeout

Introduction

In this page you can find the example usage for org.apache.thrift.transport THttpClient setReadTimeout.

Prototype

public void setReadTimeout(int timeout) 

Source Link

Usage

From source file:com.rubenlaguna.en4j.sync.EvernoteProtocolUtil.java

License:Open Source License

private NoteStore.Client getValidNoteStore()
        throws TTransportException, EDAMUserException, EDAMSystemException, TException {
    if (isAboutToExpire()) {
        // Set up the NoteStore
        AuthenticationResult authResult = getValidAuthenticationResult();
        if (null == noteStoreUrl.get()) {
            //noteStoreUrl must be cached because we don't get a User in
            //from refreshAuthentication
            User user = authResult.getUser();
            noteStoreUrl.set(noteStoreUrlBase + user.getShardId());
        }/*from   ww  w  . ja  va  2 s  .  c o  m*/
        THttpClient noteStoreTrans = new THttpClient(noteStoreUrl.get());
        noteStoreTrans.setConnectTimeout(30000); //30s
        noteStoreTrans.setReadTimeout(180 * 1000);//180s
        TBinaryProtocol noteStoreProt = new TBinaryProtocol(noteStoreTrans);
        currentNoteStore.set(new NoteStore.Client(noteStoreProt, noteStoreProt));

    }
    return currentNoteStore.get();
}