public ProtocolStack getProtocolStack() {return ch.getProtocolStack();}
public String getProperties() { return ch.getProtocolStack() != null? ch.getProtocolStack().printProtocolSpec(true) : null; }
public void setChannel(JChannel ch) { this.ch=ch; counter_prot=ch.getProtocolStack().findProtocol(COUNTER.class); if(counter_prot == null) throw new IllegalStateException("channel configuration must include the COUNTER protocol"); }
public void setChannel(JChannel ch) { this.ch=ch; lock_prot=ch.getProtocolStack().findProtocol(Locking.class); if(lock_prot == null) throw new IllegalStateException("Channel configuration must include a locking protocol " + "(subclass of " + Locking.class.getName() + ")"); }
public void setChannel(JChannel ch) { this.ch=ch; _execProt=ch.getProtocolStack().findProtocol(Executing.class); if(_execProt == null) throw new IllegalStateException("Channel configuration must include a executing protocol " + "(subclass of " + Executing.class.getName() + ")"); }
public void setChannel(JChannel ch) { this.ch=ch; _execProt=ch.getProtocolStack().findProtocol(Executing.class); if(_execProt == null) throw new IllegalStateException("Channel configuration must include a executing protocol " + "(subclass of " + Executing.class.getName() + ")"); }
protected JChannel resetAllStats() { List<Protocol> prots=ch.getProtocolStack().getProtocols(); prots.forEach(Protocol::resetStatistics); return ch.resetStats(); }
protected final JChannel init(JChannel ch) throws Exception { if(ch == null) throw new IllegalArgumentException("channel is null"); prot_stack=new ProtocolStack(this); prot_stack.setup(ch.getProtocolStack()); // Setup protocol stack (creates protocol, calls init() on them) return this; }
protected static List<String> getSites(JChannel channel) { RELAY2 relay=channel.getProtocolStack().findProtocol(RELAY2.class); return relay != null? relay.siteNames() : Collections.<String>emptyList(); }
protected static List<String> getSites(JChannel channel) { RELAY2 relay=channel.getProtocolStack().findProtocol(RELAY2.class); return relay != null? relay.siteNames() : new ArrayList<>(0); }
@Override public void getMessageState(InternalDistributedMember target, Map<String, Long> state, boolean includeMulticast) { if (includeMulticast) { NAKACK2 nakack = (NAKACK2) myChannel.getProtocolStack().findProtocol("NAKACK2"); if (nakack != null) { long seqno = nakack.getCurrentSeqno(); state.put("JGroups.mcastState", seqno); } } }
/** Dumps all protocols in string format. If include_props is set, the attrs of each protocol are also printed */ @ManagedOperation public String printProtocolSpec(boolean include_props) { ProtocolStack ps=getProtocolStack(); return ps != null? ps.printProtocolSpec(include_props) : null; }
protected void printConnections() { Protocol prot=channel.getProtocolStack().findProtocol(Util.getUnicastProtocols()); if(prot instanceof UNICAST3) System.out.println(((UNICAST3)prot).printConnections()); }
public SocketFactory getSocketFactory() {return ch.getProtocolStack().getBottomProtocol().getSocketFactory();}
protected void removeAllConnections() { Protocol prot=channel.getProtocolStack().findProtocol(Util.getUnicastProtocols()); if(prot instanceof UNICAST3) ((UNICAST3)prot).removeAllConnections(); }
@Override public JChannel createChannel() throws Exception { JChannel channel = remoteSite.getChannelFactory().createChannel(siteName); // Don't use FORK in bridge stack channel.getProtocolStack().removeProtocol(FORK.class); return channel; } };
@Override public ModelNode execute(ExpressionResolver expressionResolver, ModelNode operation, ChannelFactory factory) throws OperationFailedException { // Create a temporary channel, but don't connect it try (JChannel channel = factory.createChannel(UUID.randomUUID().toString())) { // ProtocolStack.printProtocolSpecAsXML() is very hacky and only works on an uninitialized stack List<Protocol> protocols = channel.getProtocolStack().getProtocols(); Collections.reverse(protocols); ProtocolStack stack = new ProtocolStack(); stack.addProtocols(protocols); return new ModelNode(stack.printProtocolSpecAsXML()); } catch (Exception e) { throw new OperationFailedException(e); } } },
public <X extends MessageDispatcher> X stop() { if(corr != null) { corr.stop(); if(channel instanceof JChannel) { TP transport=channel.getProtocolStack().getTransport(); corr.unregisterProbeHandler(transport); } } return (X)this; }
@Override public void accept(ChannelFactory factory) { ProtocolStack stack = this.parentChannel.get().getProtocolStack(); FORK fork = (FORK) stack.findProtocol(FORK.class); fork.remove(this.address.getLastElement().getValue()); }
public void exit() { // 8 ProtocolStack stack=channel.getProtocolStack(); String cluster_name=channel.getClusterName(); try { JmxConfigurator.unregisterChannel(channel, Util.getMBeanServer(), "jgroups", "mperf"); } catch(Exception e) { } stack.stopStack(cluster_name); stack.destroy(); }