public class TransportFactory
extends java.lang.Object
详情见: https://redkale.org
限定符和类型 | 字段和说明 |
---|---|
protected ObjectPool<java.nio.ByteBuffer> |
bufferPool |
protected java.nio.channels.AsynchronousChannelGroup |
channelGroup |
protected int |
checkinterval |
static int |
DEFAULT_READTIMEOUTSECONDS |
static int |
DEFAULT_WRITETIMEOUTSECONDS |
protected java.util.concurrent.ExecutorService |
executor |
protected java.util.Map<java.net.InetSocketAddress,java.lang.String> |
groupAddrs |
protected java.util.Map<java.lang.String,TransportGroupInfo> |
groupInfos |
protected static java.util.logging.Logger |
logger |
static java.lang.String |
NAME_CHECKINTERVAL |
static java.lang.String |
NAME_PINGINTERVAL |
static java.lang.String |
NAME_POOLMAXCONNS |
protected int |
pinginterval |
protected int |
pongLength |
protected int |
poolmaxconns |
protected int |
readTimeoutSeconds |
protected java.util.List<java.lang.ref.WeakReference<Service>> |
services |
protected javax.net.ssl.SSLContext |
sslContext |
protected TransportStrategy |
strategy |
protected java.util.List<java.lang.ref.WeakReference<Transport>> |
transportReferences |
protected int |
writeTimeoutSeconds |
限定符 | 构造器和说明 |
---|---|
protected |
TransportFactory(java.util.concurrent.ExecutorService executor,
ObjectPool<java.nio.ByteBuffer> bufferPool,
java.nio.channels.AsynchronousChannelGroup channelGroup,
javax.net.ssl.SSLContext sslContext,
int readTimeoutSeconds,
int writeTimeoutSeconds) |
protected |
TransportFactory(java.util.concurrent.ExecutorService executor,
ObjectPool<java.nio.ByteBuffer> bufferPool,
java.nio.channels.AsynchronousChannelGroup channelGroup,
javax.net.ssl.SSLContext sslContext,
int readTimeoutSeconds,
int writeTimeoutSeconds,
TransportStrategy strategy) |
限定符和类型 | 方法和说明 |
---|---|
boolean |
addGroupInfo(java.lang.String groupName,
java.net.InetSocketAddress... addrs) |
TransportFactory |
addGroupInfo(java.lang.String name,
java.util.Set<java.net.InetSocketAddress> addrs) |
boolean |
addGroupInfo(TransportGroupInfo info) |
void |
addSncpService(Service service) |
static TransportFactory |
create(java.util.concurrent.ExecutorService executor,
ObjectPool<java.nio.ByteBuffer> bufferPool,
java.nio.channels.AsynchronousChannelGroup channelGroup) |
static TransportFactory |
create(java.util.concurrent.ExecutorService executor,
ObjectPool<java.nio.ByteBuffer> bufferPool,
java.nio.channels.AsynchronousChannelGroup channelGroup,
int readTimeoutSeconds,
int writeTimeoutSeconds) |
static TransportFactory |
create(java.util.concurrent.ExecutorService executor,
ObjectPool<java.nio.ByteBuffer> bufferPool,
java.nio.channels.AsynchronousChannelGroup channelGroup,
int readTimeoutSeconds,
int writeTimeoutSeconds,
TransportStrategy strategy) |
static TransportFactory |
create(java.util.concurrent.ExecutorService executor,
ObjectPool<java.nio.ByteBuffer> bufferPool,
java.nio.channels.AsynchronousChannelGroup channelGroup,
javax.net.ssl.SSLContext sslContext) |
static TransportFactory |
create(java.util.concurrent.ExecutorService executor,
ObjectPool<java.nio.ByteBuffer> bufferPool,
java.nio.channels.AsynchronousChannelGroup channelGroup,
javax.net.ssl.SSLContext sslContext,
int readTimeoutSeconds,
int writeTimeoutSeconds) |
static TransportFactory |
create(java.util.concurrent.ExecutorService executor,
ObjectPool<java.nio.ByteBuffer> bufferPool,
java.nio.channels.AsynchronousChannelGroup channelGroup,
javax.net.ssl.SSLContext sslContext,
int readTimeoutSeconds,
int writeTimeoutSeconds,
TransportStrategy strategy) |
static TransportFactory |
create(int threads) |
static TransportFactory |
create(int threads,
int bufferPoolSize,
int bufferCapacity) |
static TransportFactory |
create(int threads,
int bufferPoolSize,
int bufferCapacity,
int readTimeoutSeconds,
int writeTimeoutSeconds) |
Transport |
createTransport(java.lang.String name,
java.lang.String protocol,
java.net.InetSocketAddress clientAddress,
java.util.Collection<java.net.InetSocketAddress> addresses) |
Transport |
createTransport(java.lang.String name,
java.lang.String protocol,
java.lang.String subprotocol,
java.net.InetSocketAddress clientAddress,
java.util.Collection<java.net.InetSocketAddress> addresses) |
Transport |
createTransportTCP(java.lang.String name,
java.net.InetSocketAddress clientAddress,
java.util.Collection<java.net.InetSocketAddress> addresses) |
TransportGroupInfo |
findGroupInfo(java.lang.String group) |
java.lang.String |
findGroupName(java.net.InetSocketAddress addr) |
java.util.function.Supplier<java.nio.ByteBuffer> |
getBufferSupplier() |
java.util.concurrent.ExecutorService |
getExecutor() |
java.util.List<TransportGroupInfo> |
getGroupInfos() |
java.util.logging.Logger |
getLogger() |
java.util.List<Service> |
getServices() |
void |
init(AnyValue conf,
java.nio.ByteBuffer pingBuffer,
int pongLength) |
Transport[] |
loadDiffGroupTransports(java.net.InetSocketAddress sncpAddress,
java.util.Set<java.lang.String> diffGroups) |
Transport |
loadRemoteTransport(java.net.InetSocketAddress sncpAddress,
java.util.Set<java.lang.String> groups) |
Transport |
loadSameGroupTransport(java.net.InetSocketAddress sncpAddress) |
boolean |
removeGroupInfo(java.lang.String groupName,
java.net.InetSocketAddress addr) |
void |
shutdownNow() |
@Comment(value="\u9ed8\u8ba4TCP\u8bfb\u53d6\u8d85\u65f6\u79d2\u6570") public static int DEFAULT_READTIMEOUTSECONDS
@Comment(value="\u9ed8\u8ba4TCP\u5199\u5165\u8d85\u65f6\u79d2\u6570") public static int DEFAULT_WRITETIMEOUTSECONDS
public static final java.lang.String NAME_POOLMAXCONNS
public static final java.lang.String NAME_PINGINTERVAL
public static final java.lang.String NAME_CHECKINTERVAL
protected static final java.util.logging.Logger logger
protected final java.util.concurrent.ExecutorService executor
protected final ObjectPool<java.nio.ByteBuffer> bufferPool
protected final java.nio.channels.AsynchronousChannelGroup channelGroup
protected final java.util.Map<java.net.InetSocketAddress,java.lang.String> groupAddrs
protected final java.util.Map<java.lang.String,TransportGroupInfo> groupInfos
protected final java.util.List<java.lang.ref.WeakReference<Service>> services
protected final java.util.List<java.lang.ref.WeakReference<Transport>> transportReferences
protected int poolmaxconns
protected int checkinterval
protected int pinginterval
protected int readTimeoutSeconds
protected int writeTimeoutSeconds
protected javax.net.ssl.SSLContext sslContext
protected int pongLength
protected final TransportStrategy strategy
protected TransportFactory(java.util.concurrent.ExecutorService executor, ObjectPool<java.nio.ByteBuffer> bufferPool, java.nio.channels.AsynchronousChannelGroup channelGroup, javax.net.ssl.SSLContext sslContext, int readTimeoutSeconds, int writeTimeoutSeconds, TransportStrategy strategy)
protected TransportFactory(java.util.concurrent.ExecutorService executor, ObjectPool<java.nio.ByteBuffer> bufferPool, java.nio.channels.AsynchronousChannelGroup channelGroup, javax.net.ssl.SSLContext sslContext, int readTimeoutSeconds, int writeTimeoutSeconds)
public void init(AnyValue conf, java.nio.ByteBuffer pingBuffer, int pongLength)
public static TransportFactory create(int threads)
public static TransportFactory create(int threads, int bufferPoolSize, int bufferCapacity)
public static TransportFactory create(int threads, int bufferPoolSize, int bufferCapacity, int readTimeoutSeconds, int writeTimeoutSeconds)
public static TransportFactory create(java.util.concurrent.ExecutorService executor, ObjectPool<java.nio.ByteBuffer> bufferPool, java.nio.channels.AsynchronousChannelGroup channelGroup)
public static TransportFactory create(java.util.concurrent.ExecutorService executor, ObjectPool<java.nio.ByteBuffer> bufferPool, java.nio.channels.AsynchronousChannelGroup channelGroup, int readTimeoutSeconds, int writeTimeoutSeconds)
public static TransportFactory create(java.util.concurrent.ExecutorService executor, ObjectPool<java.nio.ByteBuffer> bufferPool, java.nio.channels.AsynchronousChannelGroup channelGroup, int readTimeoutSeconds, int writeTimeoutSeconds, TransportStrategy strategy)
public static TransportFactory create(java.util.concurrent.ExecutorService executor, ObjectPool<java.nio.ByteBuffer> bufferPool, java.nio.channels.AsynchronousChannelGroup channelGroup, javax.net.ssl.SSLContext sslContext)
public static TransportFactory create(java.util.concurrent.ExecutorService executor, ObjectPool<java.nio.ByteBuffer> bufferPool, java.nio.channels.AsynchronousChannelGroup channelGroup, javax.net.ssl.SSLContext sslContext, int readTimeoutSeconds, int writeTimeoutSeconds)
public static TransportFactory create(java.util.concurrent.ExecutorService executor, ObjectPool<java.nio.ByteBuffer> bufferPool, java.nio.channels.AsynchronousChannelGroup channelGroup, javax.net.ssl.SSLContext sslContext, int readTimeoutSeconds, int writeTimeoutSeconds, TransportStrategy strategy)
public Transport createTransportTCP(java.lang.String name, java.net.InetSocketAddress clientAddress, java.util.Collection<java.net.InetSocketAddress> addresses)
public Transport createTransport(java.lang.String name, java.lang.String protocol, java.net.InetSocketAddress clientAddress, java.util.Collection<java.net.InetSocketAddress> addresses)
public Transport createTransport(java.lang.String name, java.lang.String protocol, java.lang.String subprotocol, java.net.InetSocketAddress clientAddress, java.util.Collection<java.net.InetSocketAddress> addresses)
public java.lang.String findGroupName(java.net.InetSocketAddress addr)
public TransportGroupInfo findGroupInfo(java.lang.String group)
public boolean addGroupInfo(java.lang.String groupName, java.net.InetSocketAddress... addrs)
public boolean removeGroupInfo(java.lang.String groupName, java.net.InetSocketAddress addr)
public TransportFactory addGroupInfo(java.lang.String name, java.util.Set<java.net.InetSocketAddress> addrs)
public boolean addGroupInfo(TransportGroupInfo info)
public Transport loadSameGroupTransport(java.net.InetSocketAddress sncpAddress)
public Transport[] loadDiffGroupTransports(java.net.InetSocketAddress sncpAddress, java.util.Set<java.lang.String> diffGroups)
public Transport loadRemoteTransport(java.net.InetSocketAddress sncpAddress, java.util.Set<java.lang.String> groups)
public java.util.concurrent.ExecutorService getExecutor()
public java.util.function.Supplier<java.nio.ByteBuffer> getBufferSupplier()
public java.util.List<TransportGroupInfo> getGroupInfos()
public java.util.logging.Logger getLogger()
public void addSncpService(Service service)
public java.util.List<Service> getServices()
public void shutdownNow()