DATAREDIS-1173 - Polishing.
Add Override annotations and Javadoc. Reformat test. Original Pull Request: #549
This commit is contained in:
committed by
Christoph Strobl
parent
e4fd036d81
commit
d054e2e5de
@@ -36,6 +36,11 @@ class JedisSubscription extends AbstractSubscription {
|
||||
this.jedisPubSub = jedisPubSub;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doClose()
|
||||
*/
|
||||
@Override
|
||||
protected void doClose() {
|
||||
if (!getChannels().isEmpty()) {
|
||||
jedisPubSub.unsubscribe();
|
||||
@@ -45,10 +50,20 @@ class JedisSubscription extends AbstractSubscription {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doPsubscribe(byte[][])
|
||||
*/
|
||||
@Override
|
||||
protected void doPsubscribe(byte[]... patterns) {
|
||||
jedisPubSub.psubscribe(patterns);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doPUnsubscribe(boolean, byte[][])
|
||||
*/
|
||||
@Override
|
||||
protected void doPUnsubscribe(boolean all, byte[]... patterns) {
|
||||
if (all) {
|
||||
jedisPubSub.punsubscribe();
|
||||
@@ -57,10 +72,20 @@ class JedisSubscription extends AbstractSubscription {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doSubscribe(byte[][])
|
||||
*/
|
||||
@Override
|
||||
protected void doSubscribe(byte[]... channels) {
|
||||
jedisPubSub.subscribe(channels);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doUnsubscribe(boolean, byte[][])
|
||||
*/
|
||||
@Override
|
||||
protected void doUnsubscribe(boolean all, byte[]... channels) {
|
||||
if (all) {
|
||||
jedisPubSub.unsubscribe();
|
||||
|
||||
@@ -67,6 +67,7 @@ public class LettuceSubscription extends AbstractSubscription {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doClose()
|
||||
*/
|
||||
@Override
|
||||
protected void doClose() {
|
||||
|
||||
if (!getChannels().isEmpty()) {
|
||||
@@ -85,6 +86,7 @@ public class LettuceSubscription extends AbstractSubscription {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doPsubscribe(byte[][])
|
||||
*/
|
||||
@Override
|
||||
protected void doPsubscribe(byte[]... patterns) {
|
||||
pubsub.psubscribe(patterns);
|
||||
}
|
||||
@@ -93,6 +95,7 @@ public class LettuceSubscription extends AbstractSubscription {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doPUnsubscribe(boolean, byte[][])
|
||||
*/
|
||||
@Override
|
||||
protected void doPUnsubscribe(boolean all, byte[]... patterns) {
|
||||
|
||||
if (all) {
|
||||
@@ -106,6 +109,7 @@ public class LettuceSubscription extends AbstractSubscription {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doSubscribe(byte[][])
|
||||
*/
|
||||
@Override
|
||||
protected void doSubscribe(byte[]... channels) {
|
||||
pubsub.subscribe(channels);
|
||||
}
|
||||
@@ -114,6 +118,7 @@ public class LettuceSubscription extends AbstractSubscription {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.util.AbstractSubscription#doUnsubscribe(boolean, byte[][])
|
||||
*/
|
||||
@Override
|
||||
protected void doUnsubscribe(boolean all, byte[]... channels) {
|
||||
|
||||
if (all) {
|
||||
@@ -122,5 +127,4 @@ public class LettuceSubscription extends AbstractSubscription {
|
||||
pubsub.unsubscribe(channels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,22 +111,42 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
*/
|
||||
protected abstract void doClose();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#getListener()
|
||||
*/
|
||||
@Override
|
||||
public MessageListener getListener() {
|
||||
return listener;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#getChannels()
|
||||
*/
|
||||
@Override
|
||||
public Collection<byte[]> getChannels() {
|
||||
synchronized (channels) {
|
||||
return clone(channels);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#getPatterns()
|
||||
*/
|
||||
@Override
|
||||
public Collection<byte[]> getPatterns() {
|
||||
synchronized (patterns) {
|
||||
return clone(patterns);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#pSubscribe(byte[][])
|
||||
*/
|
||||
@Override
|
||||
public void pSubscribe(byte[]... patterns) {
|
||||
checkPulse();
|
||||
|
||||
@@ -139,10 +159,20 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
doPsubscribe(patterns);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#pUnsubscribe()
|
||||
*/
|
||||
@Override
|
||||
public void pUnsubscribe() {
|
||||
pUnsubscribe((byte[][]) null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#subscribe(byte[][])
|
||||
*/
|
||||
@Override
|
||||
public void subscribe(byte[]... channels) {
|
||||
checkPulse();
|
||||
|
||||
@@ -155,10 +185,20 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
doSubscribe(channels);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#unsubscribe()
|
||||
*/
|
||||
@Override
|
||||
public void unsubscribe() {
|
||||
unsubscribe((byte[][]) null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#pUnsubscribe(byte[][])
|
||||
*/
|
||||
@Override
|
||||
public void pUnsubscribe(@Nullable byte[]... patts) {
|
||||
if (!isAlive()) {
|
||||
return;
|
||||
@@ -186,6 +226,11 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
closeIfUnsubscribed();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#unsubscribe(byte[][])
|
||||
*/
|
||||
@Override
|
||||
public void unsubscribe(@Nullable byte[]... chans) {
|
||||
if (!isAlive()) {
|
||||
return;
|
||||
@@ -213,6 +258,11 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
closeIfUnsubscribed();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.Subscription#isAlive()
|
||||
*/
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
return alive.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user