public abstract class AbstractRedisBolt extends BaseRichBolt
JedisCommands jedisCommands = null; try { jedisCommand = getInstance(); // do some works } finally { if (jedisCommand != null) { returnInstance(jedisCommand); } }
Modifier and Type | Field and Description |
---|---|
protected OutputCollector |
collector |
Constructor and Description |
---|
AbstractRedisBolt(JedisClusterConfig config)
Constructor for Redis Cluster environment (JedisCluster)
|
AbstractRedisBolt(JedisPoolConfig config)
Constructor for single Redis environment (JedisPool)
|
Modifier and Type | Method and Description |
---|---|
protected redis.clients.jedis.JedisCommands |
getInstance()
Borrow JedisCommands instance from container.
|
void |
prepare(Map map,
TopologyContext topologyContext,
OutputCollector collector) |
protected void |
returnInstance(redis.clients.jedis.JedisCommands instance)
Return borrowed instance to container.
|
cleanup
getComponentConfiguration
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
declareOutputFields, getComponentConfiguration
protected OutputCollector collector
public AbstractRedisBolt(JedisPoolConfig config)
config
- configuration for initializing JedisPoolpublic AbstractRedisBolt(JedisClusterConfig config)
config
- configuration for initializing JedisClusterpublic void prepare(Map map, TopologyContext topologyContext, OutputCollector collector)
protected redis.clients.jedis.JedisCommands getInstance()
JedisCommandsInstanceContainer.getInstance()
protected void returnInstance(redis.clients.jedis.JedisCommands instance)
instance
- borrowed objectCopyright © 2015 The Apache Software Foundation. All Rights Reserved.