Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1954

Allow for a separate connection timeout value

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.3
    • Java - Library
    • None

    Description

      In TSocket.java, the connect() logic uses the socket timeout value (for reads/writes) as the connection timeout, as well:

        public void open() throws TTransportException {
          if (isOpen()) {
            throw new TTransportException(TTransportException.ALREADY_OPEN, "Socket already connected.");
          }
      
          if (host_.length() == 0) {
            throw new TTransportException(TTransportException.NOT_OPEN, "Cannot open null host.");
          }
          if (port_ <= 0) {
            throw new TTransportException(TTransportException.NOT_OPEN, "Cannot open without port.");
          }
      
          if (socket_ == null) {
            initSocket();
          }
      
          try {
            socket_.connect(new InetSocketAddress(host_, port_), timeout_); <--- this value should be a separately defined
            inputStream_ = new BufferedInputStream(socket_.getInputStream(), 1024);
      

      In many applications, the duration of time one is willing to wait before establishing a connection is not the same as the duration of time one is willing to wait before timing out on a read.

      For example, I may want to time out on establishing a connection after 1 second but am willing to wait 10 seconds for long reads to complete.

      Please create a separate value that can be passed into the constructor, thanks

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            abashir Ahmed Bashir
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment