|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.data.redis.connection.util.AbstractSubscription
public abstract class AbstractSubscription
Base implementation for a subscription handling the channel/pattern registration so subclasses only have to deal with the actual registration/unregistration.
Constructor Summary | |
---|---|
protected |
AbstractSubscription(MessageListener listener)
|
protected |
AbstractSubscription(MessageListener listener,
byte[][] channels,
byte[][] patterns)
Constructs a new AbstractSubscription instance. |
Method Summary | |
---|---|
protected abstract void |
doClose()
Shutdown the subscription and free any resources held. |
protected abstract void |
doPsubscribe(byte[]... patterns)
Subscribe to the given patterns |
protected abstract void |
doPUnsubscribe(boolean all,
byte[]... patterns)
Pattern unsubscribe. |
protected abstract void |
doSubscribe(byte[]... channels)
Subscribe to the given channels. |
protected abstract void |
doUnsubscribe(boolean all,
byte[]... channels)
Channel unsubscribe. |
Collection<byte[]> |
getChannels()
Returns the (named) channels for this subscription. |
MessageListener |
getListener()
Returns the listener used for this subscription. |
Collection<byte[]> |
getPatterns()
Returns the channel patters for this subscription. |
boolean |
isAlive()
Indicates whether this subscription is still 'alive' or not. |
void |
pSubscribe(byte[]... patterns)
Adds the given channel patterns to the current subscription. |
void |
pUnsubscribe()
Cancels the subscription for all channels matched by patterns. |
void |
pUnsubscribe(byte[]... patts)
Cancels the subscription for all channels matching the given patterns. |
void |
subscribe(byte[]... channels)
Adds the given channels to the current subscription. |
void |
unsubscribe()
Cancels the current subscription for all channels given by name. |
void |
unsubscribe(byte[]... chans)
Cancels the current subscription for all given channels. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractSubscription(MessageListener listener)
protected AbstractSubscription(MessageListener listener, byte[][] channels, byte[][] patterns)
AbstractSubscription
instance. Allows channels and patterns to be added
to the subscription w/o triggering a subscription action (as some clients (Jedis) require an initial call
before entering into listening mode).
listener
- channels
- patterns
- Method Detail |
---|
protected abstract void doSubscribe(byte[]... channels)
channels
- channels to subscribe toprotected abstract void doUnsubscribe(boolean all, byte[]... channels)
all
- true if all the channels are unsubscribed (used as a hint for the underlying implementation).channels
- channels to be unsubscribedprotected abstract void doPsubscribe(byte[]... patterns)
patterns
- patterns to subscribe toprotected abstract void doPUnsubscribe(boolean all, byte[]... patterns)
all
- true if all the patterns are unsubscribed (used as a hint for the underlying implementation).patterns
- patterns to be unsubscribedprotected abstract void doClose()
public MessageListener getListener()
Subscription
getListener
in interface Subscription
public Collection<byte[]> getChannels()
Subscription
getChannels
in interface Subscription
public Collection<byte[]> getPatterns()
Subscription
getPatterns
in interface Subscription
public void pSubscribe(byte[]... patterns)
Subscription
pSubscribe
in interface Subscription
patterns
- channel patternspublic void pUnsubscribe()
Subscription
pUnsubscribe
in interface Subscription
public void subscribe(byte[]... channels)
Subscription
subscribe
in interface Subscription
channels
- channel namespublic void unsubscribe()
Subscription
unsubscribe
in interface Subscription
public void pUnsubscribe(byte[]... patts)
Subscription
pUnsubscribe
in interface Subscription
public void unsubscribe(byte[]... chans)
Subscription
unsubscribe
in interface Subscription
chans
- channel namespublic boolean isAlive()
Subscription
isAlive
in interface Subscription
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |