From b4ba3824041e73709540736b7e86b82d012315c1 Mon Sep 17 00:00:00 2001 From: Iwein Fuld Date: Thu, 14 Aug 2008 20:16:56 +0000 Subject: [PATCH] added missing interface --- .../adapter/ftp/FTPClientPool.java | 43 +++++++++++++++++++ .../adapter/ftp/QueuedFTPClientPool.java | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/FTPClientPool.java diff --git a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/FTPClientPool.java b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/FTPClientPool.java new file mode 100644 index 0000000000..c6ba4aa79a --- /dev/null +++ b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/FTPClientPool.java @@ -0,0 +1,43 @@ +/* + * Copyright 2002-2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.adapter.ftp; + +import org.apache.commons.net.ftp.FTPClient; + +/** + * A pool of {@link FTPClient} instances. The pool can be used to control the + * number of open ftp connections and reuse these connections efficiently. + * @author Iwein Fuld + * + */ +public interface FTPClientPool extends FTPClientFactory { + + /** + * Releases the client back to the pool. When calling this method the caller + * is no longer responsible for the connection. The pool is free to do with + * it as it sees fit, which means either recycling or disconnecting it most + * probably. + * + * The caller should NOT disconnect the client before calling this method. + * + * The caller is NOT expected to use the client after calling this method. + * Doing so can lead to unexpected behavior. + * + * @param client + */ + void releaseClient(FTPClient client); + +} \ No newline at end of file diff --git a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/QueuedFTPClientPool.java b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/QueuedFTPClientPool.java index e57e556fb6..cd1a4c8219 100644 --- a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/QueuedFTPClientPool.java +++ b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/ftp/QueuedFTPClientPool.java @@ -35,7 +35,7 @@ import org.springframework.util.Assert; * * @author Iwein Fuld */ -public class QueuedFTPClientPool { +public class QueuedFTPClientPool implements FTPClientPool { private static final int DEFAULT_POOL_SIZE = 5;