facebookarchive / swift

An annotation-based Java library for creating Thrift serializable types and services.
Apache License 2.0
900 stars 297 forks source link

Problem with closed channel #339

Closed johje349 closed 7 years ago

johje349 commented 7 years ago

I have a client created in the following way:

private ManagerService initManagerThriftClient() {
    ManagerService thriftClient = null;

    try {
        HttpClientConnector connector = new HttpClientConnector(URI.create("http://xxxxxx:8080/thriftservice"));

        ThriftClientManager clientManager = new ThriftClientManager(new ThriftCodecManager());
        thriftClient = clientManager.createClient(connector, ManagerService.class).get();
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    return thriftClient;
}

I then call remote methods, e.g: managerThriftClient.userLogin(username, password, ipAddress);

The problem is after a while I get a Channel Closed exception: org.apache.thrift.transport.TTransportException: Channel closed

I cannot seem to find a way to set keeaplive or timeouts on the connection. Any ideas how to solve this?