| | |
| | | import org.opends.server.types.ResultCode; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.SearchResultReference; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | // The time that the last operation was completed. |
| | | private AtomicLong lastCompletionTime; |
| | | |
| | | // The next operation ID that should be used for this connection. |
| | | private AtomicLong nextOperationID; |
| | | |
| | |
| | | |
| | | ldapVersion = 3; |
| | | requestHandler = null; |
| | | lastCompletionTime = new AtomicLong(TimeThread.getTime()); |
| | | nextOperationID = new AtomicLong(0); |
| | | connectionValid = true; |
| | | disconnectRequested = false; |
| | |
| | | } |
| | | |
| | | operationsInProgress.remove(messageID); |
| | | lastCompletionTime.set(TimeThread.getTime()); |
| | | |
| | | throw de; |
| | | } |
| | |
| | | public boolean removeOperationInProgress(int messageID) |
| | | { |
| | | AbstractOperation operation = operationsInProgress.remove(messageID); |
| | | return (operation != null); |
| | | if (operation == null) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | lastCompletionTime.set(TimeThread.getTime()); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (! (operationsInProgress.isEmpty() && |
| | | getPersistentSearches().isEmpty())) |
| | | { |
| | | lastCompletionTime.set(TimeThread.getTime()); |
| | | } |
| | | |
| | | operationsInProgress.clear(); |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | operationsInProgress.remove(msgID); |
| | | lastCompletionTime.set(TimeThread.getTime()); |
| | | } |
| | | |
| | | |
| | | for (PersistentSearch persistentSearch : getPersistentSearches()) |
| | | { |
| | | DirectoryServer.deregisterPersistentSearch(persistentSearch); |
| | | lastCompletionTime.set(TimeThread.getTime()); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | { |
| | | return connectionHandler.getSSLServerCertNickname(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the length of time in milliseconds that this client |
| | | * connection has been idle. |
| | | * <BR><BR> |
| | | * Note that the default implementation will always return zero. |
| | | * Subclasses associated with connection handlers should override |
| | | * this method if they wish to provided idle time limit |
| | | * functionality. |
| | | * |
| | | * @return The length of time in milliseconds that this client |
| | | * connection has been idle. |
| | | */ |
| | | public long getIdleTime() |
| | | { |
| | | if (operationsInProgress.isEmpty() && getPersistentSearches().isEmpty()) |
| | | { |
| | | return (TimeThread.getTime() - lastCompletionTime.get()); |
| | | } |
| | | else |
| | | { |
| | | // There's at least one operation in progress, so it's not idle. |
| | | return 0L; |
| | | } |
| | | } |
| | | } |
| | | |