Uploaded image for project: 'OpenShift Java Client'
  1. OpenShift Java Client
  2. OSJC-61

openshift-java-client: remove hard coded default timeout, dont set HttpUrlConnection timeout

    XMLWordPrintable

Details

    Description

      The current code to set timeouts in openshift-java-client is:

      private int getTimeout(int timeout, int openShiftTimeout, int systemPropertyTimeout, int defaultTimeout) {
      	if (timeout == NO_TIMEOUT) {
      		timeout = openShiftTimeout;
      		if (timeout == NO_TIMEOUT) {
      			timeout = systemPropertyTimeout;
      			if (timeout == NO_TIMEOUT) {
      				timeout = defaultTimeout;
      			}
      		}
      	}
      	return timeout;
      }
      

      calling it looks like this:

      private void setReadTimeout(int timeout, URLConnection connection) {
      	connection.setReadTimeout(
      			getTimeout(
      					timeout,
      					getSystemPropertyInteger(SYSPROP_OPENSHIFT_READ_TIMEOUT),
      					getSystemPropertyInteger(SYSPROP_DEFAULT_READ_TIMEOUT),
      					DEFAULT_READ_TIMEOUT));
      }
      

      DEFAULT_READ_TIMEOUT should get eliminated, we should use the SYSPROP_OPENSHIFT_READ_TIMEOUT as this. Furthermore there's no need to set the SYSPROP_DEFAULT_READ_TIMEOUT.

      Attachments

        Issue Links

          Activity

            People

              cdaley Corey Daley
              adietish@redhat.com André Dietisheim
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: