public class SftpPool extends org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>
| 限定符 | 构造器和说明 |
|---|---|
protected |
SftpPool(SftpPooledFactory factory,
org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig<SftpConnect> config) |
| 限定符和类型 | 方法和说明 |
|---|---|
SftpConnect |
borrowObject(SftpConnConfig config)
从连接池中获取一个sftp链接
注意: 使用完后需要自行调用
returnSftp(SftpConnect) 方法交还 |
SftpConnect |
borrowObject(String sftpId)
从连接池中获取一个sftp链接
通过事先定义的 sftpId 获取sftp链接
如果不存在则抛出异常
注意: 使用完后需要自行调用
returnSftp(SftpConnect) 方法交还 |
SftpConnect |
borrowObject(String host,
Integer port,
String user,
String password)
从连接池中获取一个sftp链接
如果不存在则创建一个新连接
|
void |
clear()
清除池中闲置的对象
|
void |
clear(String sftpId)
清除指定 Id 的对象
|
void |
close()
关闭连接池
|
int |
getNumActive()
获取活跃数, 也就是被从连接池中出来的sftp链接
|
int |
getNumActive(String sftpId)
获取指定 Id 的活跃数
|
int |
getNumIdle()
获取空闲数
|
int |
getNumIdle(String sftpId)
获取指定 Id 的空闲数
|
void |
invalidateObject(String sftpId,
SftpConnect sftpConnect)
使池中的对象失效,当获取到的对象被确定无效时(由于异常或其他问题),应该调用该方法
当要把一个借走的对象置为无效的时候。
|
void |
invalidateSftp(SftpConnect sftpConnect) |
void |
returnSftp(SftpConnect sftpConnect)
将使用完的sftp链接交还给连接池
|
void |
setConfig(SftpPoolConfig config) |
addObject, borrowObject, clearOldest, evict, getFactory, getMaxIdlePerKey, getMaxTotalPerKey, getMinIdlePerKey, getNumActivePerKey, getNumWaiters, getNumWaitersByKey, listAllObjects, preparePool, returnObject, setConfig, setMaxIdlePerKey, setMaxTotalPerKey, setMinIdlePerKey, toStringAppendFieldsgetBlockWhenExhausted, getBorrowedCount, getCreatedCount, getCreationStackTrace, getDestroyedByBorrowValidationCount, getDestroyedByEvictorCount, getDestroyedCount, getEvictionPolicy, getEvictionPolicyClassName, getEvictorShutdownTimeoutMillis, getFairness, getJmxName, getLifo, getMaxBorrowWaitTimeMillis, getMaxTotal, getMaxWaitMillis, getMeanActiveTimeMillis, getMeanBorrowWaitTimeMillis, getMeanIdleTimeMillis, getMinEvictableIdleTimeMillis, getNumTestsPerEvictionRun, getReturnedCount, getSoftMinEvictableIdleTimeMillis, getSwallowedExceptionListener, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, isClosed, markReturningState, setBlockWhenExhausted, setConfig, setEvictionPolicy, setEvictionPolicyClassName, setEvictionPolicyClassName, setEvictorShutdownTimeoutMillis, setLifo, setMaxTotal, setMaxWaitMillis, setMinEvictableIdleTimeMillis, setNumTestsPerEvictionRun, setSoftMinEvictableIdleTimeMillis, setSwallowedExceptionListener, setTestOnBorrow, setTestOnCreate, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillisclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBlockWhenExhausted, getBorrowedCount, getCreatedCount, getCreationStackTrace, getDestroyedByBorrowValidationCount, getDestroyedByEvictorCount, getDestroyedCount, getFairness, getLifo, getMaxBorrowWaitTimeMillis, getMaxTotal, getMaxWaitMillis, getMeanActiveTimeMillis, getMeanBorrowWaitTimeMillis, getMeanIdleTimeMillis, getMinEvictableIdleTimeMillis, getNumTestsPerEvictionRun, getReturnedCount, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, isClosedprotected SftpPool(SftpPooledFactory factory, org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig<SftpConnect> config)
public SftpConnect borrowObject(SftpConnConfig config) throws Exception
returnSftp(SftpConnect) 方法交还config - sftp链接配置Exceptionpublic SftpConnect borrowObject(String host, Integer port, String user, String password) throws Exception
host - sftp服务ipport - 端口user - 用户名password - 密码Exceptionpublic SftpConnect borrowObject(String sftpId) throws Exception
returnSftp(SftpConnect) 方法交还borrowObject 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>borrowObject 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>sftpId - 通过事先定义的 sftpId 获取sftp链接Exceptionpublic void invalidateObject(String sftpId, SftpConnect sftpConnect) throws Exception
invalidateObject 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>invalidateObject 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>sftpId - 指定sftp的唯一idsftpConnect - sftp链接对象Exception - 失效失败抛出异常public void invalidateSftp(SftpConnect sftpConnect) throws Exception
Exceptionpublic void returnSftp(SftpConnect sftpConnect)
sftpConnect - sftp链接对象public int getNumActive()
getNumActive 在接口中 org.apache.commons.pool2.impl.GenericKeyedObjectPoolMXBean<String>getNumActive 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>getNumActive 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>public int getNumActive(String sftpId)
getNumActive 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>getNumActive 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>sftpId - 指定sftp的唯一idpublic int getNumIdle()
getNumIdle 在接口中 org.apache.commons.pool2.impl.GenericKeyedObjectPoolMXBean<String>getNumIdle 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>getNumIdle 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>public int getNumIdle(String sftpId)
getNumIdle 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>getNumIdle 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>sftpId - 指定sftp的唯一idpublic void clear()
clear 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>clear 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>public void clear(String sftpId)
clear 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>clear 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>sftpId - 指定sftp的唯一idpublic void close()
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在接口中 org.apache.commons.pool2.KeyedObjectPool<String,SftpConnect>close 在类中 org.apache.commons.pool2.impl.GenericKeyedObjectPool<String,SftpConnect>public void setConfig(SftpPoolConfig config)
Copyright © 2021. All rights reserved.