487 // the selector thread to terminate more timely - for when nothing is |
487 // the selector thread to terminate more timely - for when nothing is |
488 // ongoing it will only check for that condition every NODEADLINE ms. |
488 // ongoing it will only check for that condition every NODEADLINE ms. |
489 // To avoid misuse of the property, the delay that can be specified |
489 // To avoid misuse of the property, the delay that can be specified |
490 // is comprised between [MIN_NODEADLINE, MAX_NODEADLINE], and its default |
490 // is comprised between [MIN_NODEADLINE, MAX_NODEADLINE], and its default |
491 // value if unspecified (or <= 0) is DEF_NODEADLINE = 3000ms |
491 // value if unspecified (or <= 0) is DEF_NODEADLINE = 3000ms |
492 // The property is -Djdk.httpclient.internal.selector.timeout=<millis> |
492 // The property is -Djdk.internal.httpclient.selectorTimeout=<millis> |
493 private static final int MIN_NODEADLINE = 1000; // ms |
493 private static final int MIN_NODEADLINE = 1000; // ms |
494 private static final int MAX_NODEADLINE = 1000 * 1200; // ms |
494 private static final int MAX_NODEADLINE = 1000 * 1200; // ms |
495 private static final int DEF_NODEADLINE = 3000; // ms |
495 private static final int DEF_NODEADLINE = 3000; // ms |
496 private static final long NODEADLINE; // default is DEF_NODEADLINE ms |
496 private static final long NODEADLINE; // default is DEF_NODEADLINE ms |
497 static { |
497 static { |
498 // ensure NODEADLINE is initialized with some valid value. |
498 // ensure NODEADLINE is initialized with some valid value. |
499 long deadline = Utils.getIntegerNetProperty( |
499 long deadline = Utils.getIntegerProperty( |
500 "jdk.httpclient.internal.selector.timeout", |
500 "jdk.internal.httpclient.selectorTimeout", |
501 DEF_NODEADLINE); // millis |
501 DEF_NODEADLINE); // millis |
502 if (deadline <= 0) deadline = DEF_NODEADLINE; |
502 if (deadline <= 0) deadline = DEF_NODEADLINE; |
503 deadline = Math.max(deadline, MIN_NODEADLINE); |
503 deadline = Math.max(deadline, MIN_NODEADLINE); |
504 NODEADLINE = Math.min(deadline, MAX_NODEADLINE); |
504 NODEADLINE = Math.min(deadline, MAX_NODEADLINE); |
505 } |
505 } |