Package one.nio.pool
Class SocketPool
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.AbstractSequentialList<E>
-
- java.util.LinkedList<T>
-
- one.nio.pool.Pool<Socket>
-
- one.nio.pool.SocketPool
-
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,Cloneable,Iterable<Socket>,Collection<Socket>,Deque<Socket>,List<Socket>,Queue<Socket>,SocketPoolMXBean
- Direct Known Subclasses:
HttpClient,RpcClient
public class SocketPool extends Pool<Socket> implements SocketPoolMXBean
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intconnectTimeoutprotected Stringhostprotected intportprotected Proxyproxyprotected intreadTimeoutprotected SslContextsslContextprotected inttos-
Fields inherited from class one.nio.pool.Pool
closed, createdCount, fifo, initialCount, keepEmpty, maxCount, timeout, timeouts, waitingThreads
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description SocketPool(ConnectionString conn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SocketcreateObject()voiddestroyObject(Socket socket)intgetBusyCount()intgetConnectTimeout()booleangetFifo()intgetIdleCount()intgetMaxCount()ProxygetProxy()intgetReadTimeout()SslContextgetSslContext()intgetTimeout()intgetTimeouts()intgetWaitingThreads()Stringname()voidsetConnectTimeout(int connectTimeout)voidsetFifo(boolean fifo)voidsetMaxCount(int maxCount)protected voidsetProperties(ConnectionString conn)voidsetProxy(Proxy proxy)voidsetReadTimeout(int readTimeout)voidsetSslContext(SslContext sslContext)voidsetTimeout(int timeout)-
Methods inherited from class one.nio.pool.Pool
borrowObject, close, initialize, invalidateAll, invalidateObject, isClosed, returnObject
-
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
-
Methods inherited from class java.util.AbstractSequentialList
iterator
-
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
Methods inherited from interface one.nio.pool.SocketPoolMXBean
invalidateAll, isClosed
-
-
-
-
Field Detail
-
host
protected String host
-
port
protected int port
-
readTimeout
protected int readTimeout
-
connectTimeout
protected int connectTimeout
-
tos
protected int tos
-
sslContext
protected SslContext sslContext
-
proxy
protected Proxy proxy
-
-
Constructor Detail
-
SocketPool
public SocketPool(ConnectionString conn)
-
-
Method Detail
-
setProperties
protected void setProperties(ConnectionString conn)
-
getTimeouts
public int getTimeouts()
- Specified by:
getTimeoutsin interfaceSocketPoolMXBean
-
getWaitingThreads
public int getWaitingThreads()
- Specified by:
getWaitingThreadsin interfaceSocketPoolMXBean
-
getBusyCount
public int getBusyCount()
- Specified by:
getBusyCountin interfaceSocketPoolMXBean
-
getIdleCount
public int getIdleCount()
- Specified by:
getIdleCountin interfaceSocketPoolMXBean
-
getMaxCount
public int getMaxCount()
- Specified by:
getMaxCountin interfaceSocketPoolMXBean
-
setMaxCount
public void setMaxCount(int maxCount)
- Specified by:
setMaxCountin interfaceSocketPoolMXBean
-
getTimeout
public int getTimeout()
- Specified by:
getTimeoutin interfaceSocketPoolMXBean
-
setTimeout
public void setTimeout(int timeout)
- Specified by:
setTimeoutin interfaceSocketPoolMXBean
-
getReadTimeout
public int getReadTimeout()
- Specified by:
getReadTimeoutin interfaceSocketPoolMXBean
-
setReadTimeout
public void setReadTimeout(int readTimeout)
- Specified by:
setReadTimeoutin interfaceSocketPoolMXBean
-
getConnectTimeout
public int getConnectTimeout()
- Specified by:
getConnectTimeoutin interfaceSocketPoolMXBean
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout)
- Specified by:
setConnectTimeoutin interfaceSocketPoolMXBean
-
getFifo
public boolean getFifo()
- Specified by:
getFifoin interfaceSocketPoolMXBean
-
setFifo
public void setFifo(boolean fifo)
- Specified by:
setFifoin interfaceSocketPoolMXBean
-
getSslContext
public SslContext getSslContext()
-
setSslContext
public void setSslContext(SslContext sslContext)
-
getProxy
public Proxy getProxy()
-
setProxy
public void setProxy(Proxy proxy)
-
createObject
public Socket createObject() throws PoolException
- Specified by:
createObjectin classPool<Socket>- Throws:
PoolException
-
destroyObject
public void destroyObject(Socket socket)
- Overrides:
destroyObjectin classPool<Socket>
-
-