本文整理汇总了Java中net.jodah.lyra.event.ChannelListener类的典型用法代码示例。如果您正苦于以下问题:Java ChannelListener类的具体用法?Java ChannelListener怎么用?Java ChannelListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChannelListener类属于net.jodah.lyra.event包,在下文中一共展示了ChannelListener类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addChannelListener
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
@Override
public void addChannelListener(final Channel channel,final ChannelListener channelListener) {
Set<ChannelListener> listeners = this.channelListenerRegistry.get(channel);
if(listeners == null) {
listeners = Collections.newSetFromMap(new ConcurrentHashMap<ChannelListener, Boolean>());
if(this.channelListenerRegistry.putIfAbsent(channel,listeners) != null) {
// was already created
listeners = this.channelListenerRegistry.get(channel);
}
}
listeners.add(channelListener);
}
示例2: removeChannelListener
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
@Override
public void removeChannelListener(final Channel channel,final ChannelListener channelListener) {
final Set<ChannelListener> listeners = this.channelListenerRegistry.get(channel);
if(listeners != null) {
listeners.remove(channelListener);
}
}
示例3: propagateChannelEvent
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
private void propagateChannelEvent(final Channel channel, final Consumer<ChannelListener> channelEvent, final String channelEventName) {
final Set<ChannelListener> listeners = this.channelListenerRegistry.get(channel);
if(listeners != null) {
for (ChannelListener listener : listeners) {
try {
channelEvent.accept(listener);
} catch(Exception e) {
logger.error(format("Exception while calling [%s] on ChannelListener [%s]", channelEventName, listener.toString()),e);
}
}
}
}
示例4: notifyRecoveryStarted
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
private void notifyRecoveryStarted() {
for (ChannelListener listener : config.getChannelListeners())
try {
listener.onRecoveryStarted(proxy);
} catch (Exception ignore) {
}
}
示例5: notifyRecovery
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
private void notifyRecovery() {
for (ChannelListener listener : config.getChannelListeners())
try {
if (!recoveryPending.get())
listener.onRecovery(proxy);
} catch (Exception ignore) {
}
}
示例6: notifyRecoveryCompleted
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
private void notifyRecoveryCompleted() {
for (ChannelListener listener : config.getChannelListeners())
try {
listener.onRecoveryCompleted(proxy);
} catch (Exception ignore) {
}
}
示例7: recoveryFailed
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
private void recoveryFailed(Exception e) {
log.error("Failed to recover {}", this, e);
recoveryComplete();
interruptWaiters();
for (ChannelListener listener : config.getChannelListeners())
try {
listener.onRecoveryFailure(proxy, e);
} catch (Exception ignore) {
}
}
示例8: getChannelListeners
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
@Override
public Collection<ChannelListener> getChannelListeners() {
return channelListeners != null ? channelListeners : parent != null ? parent.getChannelListeners()
: Collections.<ChannelListener>emptyList();
}
示例9: withChannelListeners
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
@Override
public Config withChannelListeners(ChannelListener... channelListeners) {
this.channelListeners = Arrays.asList(channelListeners);
return this;
}
示例10: getChannelListeners
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
/**
* Returns the channel's listeners else empty list if none were configured.
*
* @see #withChannelListeners(ChannelListener...)
*/
Collection<ChannelListener> getChannelListeners();
示例11: withChannelListeners
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
/**
* Sets the {@code channelListeners} to call on channel related events.
*/
ChannelConfig withChannelListeners(ChannelListener... channelListeners);
示例12: addChannelListener
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
void addChannelListener(Channel channel,ChannelListener channelListener);
示例13: removeChannelListener
import net.jodah.lyra.event.ChannelListener; //导入依赖的package包/类
void removeChannelListener(Channel channel, ChannelListener channelListener);