diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2014-08-08 13:33:18 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2014-08-08 13:33:18 -0230 |
commit | c540f34ba2dd245e88cee99f39552efbd44c91e1 (patch) | |
tree | a637ce6dce7ad189069e784f21d5166c6a98aff1 /java/src/IceInternal/TcpEndpointI.java | |
parent | Fixed (ICE-5583) - Consider adding IceSSL.CertAuthFile to C# implementation (diff) | |
download | ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.tar.bz2 ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.tar.xz ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.zip |
ICE-5596 add Ice.Default.Timeout property
Diffstat (limited to 'java/src/IceInternal/TcpEndpointI.java')
-rw-r--r-- | java/src/IceInternal/TcpEndpointI.java | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java index 564e5292371..f002f0f4101 100644 --- a/java/src/IceInternal/TcpEndpointI.java +++ b/java/src/IceInternal/TcpEndpointI.java @@ -22,7 +22,7 @@ final class TcpEndpointI extends IPEndpointI public TcpEndpointI(ProtocolInstance instance) { super(instance); - _timeout = -1; + _timeout = -2; _compress = false; } @@ -179,7 +179,11 @@ final class TcpEndpointI extends IPEndpointI // String s = super.options(); - if(_timeout != -1) + if(_timeout == -1) + { + s += " -t infinite"; + } + else { s += " -t " + _timeout; } @@ -260,6 +264,17 @@ final class TcpEndpointI extends IPEndpointI } @Override + public void initWithOptions(java.util.ArrayList<String> args, boolean oaEndpoint) + { + super.initWithOptions(args, oaEndpoint); + + if(_timeout == -2) + { + _timeout = _instance.defaultTimeout(); + } + } + + @Override protected boolean checkOption(String option, String argument, String endpoint) { if(super.checkOption(option, argument, endpoint)) @@ -276,14 +291,26 @@ final class TcpEndpointI extends IPEndpointI throw new Ice.EndpointParseException("no argument provided for -t option in endpoint " + endpoint); } - try + if(argument.equals("infinite")) { - _timeout = Integer.parseInt(argument); + _timeout = -1; } - catch(NumberFormatException ex) + else { - throw new Ice.EndpointParseException("invalid timeout value `" + argument + - "' in endpoint " + endpoint); + try + { + _timeout = Integer.parseInt(argument); + if(_timeout < 1) + { + throw new Ice.EndpointParseException("invalid timeout value `" + argument + + "' in endpoint " + endpoint); + } + } + catch(NumberFormatException ex) + { + throw new Ice.EndpointParseException("invalid timeout value `" + argument + + "' in endpoint " + endpoint); + } } return true; |