Revert commit 6559 and complete commit 6550.
There were some inconsistencies in the way the connectTimeout was applied to the tools.
The time out should only apply to the establishing of the connection not to every operation done in the connection. But due to a defect, the timeout was kept for all subsequent operations preventing some of them to complete.
The proposed changes reset the timeout of the socket to 0 (no timeout) once the connection has been established.
Default connection timeout has been reset to 30 seconds for all tools.
| | |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.messages.Message; |
| | | |
| | | import java.io.BufferedReader; |
| | |
| | | version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | | int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout(); |
| | | connectTimeout = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT, |
| | | null, OPTION_LONG_CONNECT_TIMEOUT, |
| | | false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(), |
| | | 0, null, |
| | | defaultTimeout, null, |
| | | true, 0, false, Integer.MAX_VALUE, |
| | | INFO_DESCRIPTION_CONNECTION_TIMEOUT.get()); |
| | | connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT); |
| | |
| | | import java.io.IOException; |
| | | import java.net.ConnectException; |
| | | import java.net.Socket; |
| | | import java.net.SocketException; |
| | | import java.net.UnknownHostException; |
| | | import java.util.ArrayList; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | |
| | | private LDAPReader ldapReader; |
| | | private int versionNumber = 3; |
| | | |
| | | private PrintStream out; |
| | | private PrintStream err; |
| | | private final PrintStream out; |
| | | private final PrintStream err; |
| | | |
| | | /** |
| | | * Constructor for the LDAPConnection object. |
| | |
| | | throw new LDAPConnectionException( |
| | | Message.raw(ex.getLocalizedMessage()),ex); |
| | | } |
| | | finally |
| | | { |
| | | if (timeout > 0) |
| | | { |
| | | try |
| | | { |
| | | socket.setSoTimeout(0); |
| | | } |
| | | catch (SocketException e) |
| | | { |
| | | e.printStackTrace(); |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.messages.Message; |
| | | |
| | | import java.io.BufferedReader; |
| | |
| | | version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | | int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout(); |
| | | connectTimeout = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT, |
| | | null, OPTION_LONG_CONNECT_TIMEOUT, |
| | | false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(), |
| | | 0, null, |
| | | defaultTimeout, null, |
| | | true, 0, false, Integer.MAX_VALUE, |
| | | INFO_DESCRIPTION_CONNECTION_TIMEOUT.get()); |
| | | connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT); |
| | |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.messages.Message; |
| | | |
| | | import java.io.FileInputStream; |
| | |
| | | version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | | int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout(); |
| | | connectTimeout = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT, |
| | | null, OPTION_LONG_CONNECT_TIMEOUT, |
| | | false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(), |
| | | 0, null, |
| | | defaultTimeout, null, |
| | | true, 0, false, Integer.MAX_VALUE, |
| | | INFO_DESCRIPTION_CONNECTION_TIMEOUT.get()); |
| | | connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT); |
| | |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | |
| | | controlStr.setPropertyName("control"); |
| | | argParser.addArgument(controlStr); |
| | | |
| | | int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout(); |
| | | connectTimeout = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT, |
| | | null, OPTION_LONG_CONNECT_TIMEOUT, |
| | | false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(), |
| | | 0, null, |
| | | defaultTimeout, null, |
| | | true, 0, false, Integer.MAX_VALUE, |
| | | INFO_DESCRIPTION_CONNECTION_TIMEOUT.get()); |
| | | connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT); |
| | |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.messages.Message; |
| | | |
| | | import java.io.BufferedReader; |
| | |
| | | version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION); |
| | | argParser.addArgument(version); |
| | | |
| | | int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout(); |
| | | connectTimeout = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT, |
| | | null, OPTION_LONG_CONNECT_TIMEOUT, |
| | | false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(), |
| | | 0, null, |
| | | defaultTimeout, null, |
| | | true, 0, false, Integer.MAX_VALUE, |
| | | INFO_DESCRIPTION_CONNECTION_TIMEOUT.get()); |
| | | connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | import org.opends.messages.Message; |
| | |
| | | import javax.net.ssl.X509TrustManager; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |