public class KafkaSharedConnPool extends Object implements ConnectionPool<org.apache.kafka.clients.producer.Producer<byte[],byte[]>>
Title: KafkaSharedConnPool
Description: Kafka共享连接池(单例)
ConnectionPool,
序列化表格| 限定符和类型 | 字段和说明 |
|---|---|
private static AtomicReference<KafkaSharedConnPool> |
pool |
private org.apache.kafka.clients.producer.Producer<byte[],byte[]> |
producer |
| 限定符 | 构造器和说明 |
|---|---|
private |
KafkaSharedConnPool(Properties properties) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Close.
|
org.apache.kafka.clients.producer.Producer<byte[],byte[]> |
getConnection()
Title: getConnection
Description: 获取连接
|
static KafkaSharedConnPool |
getInstance(Properties properties)
Gets instance.
|
static KafkaSharedConnPool |
getInstance(String brokers,
String codec,
String keySer,
String valSer)
Gets instance.
|
void |
invalidateConnection(org.apache.kafka.clients.producer.Producer<byte[],byte[]> conn)
Title: invalidateConnection
Description: 废弃连接
|
void |
returnConnection(org.apache.kafka.clients.producer.Producer<byte[],byte[]> conn)
Title: returnConnection
Description: 返回连接
|
private static final AtomicReference<KafkaSharedConnPool> pool
private final org.apache.kafka.clients.producer.Producer<byte[],byte[]> producer
private KafkaSharedConnPool(Properties properties)
public static KafkaSharedConnPool getInstance(String brokers, String codec, String keySer, String valSer)
brokers - the brokerscodec - the codeckeySer - the key servalSer - the val serpublic static KafkaSharedConnPool getInstance(Properties properties)
properties - the propertiespublic org.apache.kafka.clients.producer.Producer<byte[],byte[]> getConnection()
ConnectionPoolTitle: getConnection
Description: 获取连接
getConnection 在接口中 ConnectionPool<org.apache.kafka.clients.producer.Producer<byte[],byte[]>>public void returnConnection(org.apache.kafka.clients.producer.Producer<byte[],byte[]> conn)
ConnectionPoolTitle: returnConnection
Description: 返回连接
returnConnection 在接口中 ConnectionPool<org.apache.kafka.clients.producer.Producer<byte[],byte[]>>conn - 连接public void invalidateConnection(org.apache.kafka.clients.producer.Producer<byte[],byte[]> conn)
ConnectionPoolTitle: invalidateConnection
Description: 废弃连接
invalidateConnection 在接口中 ConnectionPool<org.apache.kafka.clients.producer.Producer<byte[],byte[]>>conn - 连接public void close()
Copyright © 2015-2016 Dark Phoenixs. All Rights Reserved.