/** * Adds a list of protocols * @param prots * @return * @since 2.11 */ public ProtocolStack addProtocols(Protocol ... prots) { if(prots != null) { for(Protocol prot: prots) addProtocol(prot); } return this; }
/** * Creates a channel from a list of protocols. Note that after a {@link org.jgroups.JChannel#close()}, the protocol * list <em>should not</em> be reused, ie. new JChannel(protocols) would reuse the same protocol list, and this * might lead to problems ! * @param protocols The list of protocols, from bottom to top, ie. the first protocol in the list is the transport, * the last the top protocol * @deprecated Use {@link JChannel#JChannel(List)} instead */ @Deprecated public JChannel(Collection<Protocol> protocols) throws Exception { prot_stack=new ProtocolStack().setChannel(this); for(Protocol prot: protocols) { prot_stack.addProtocol(prot); prot.setProtocolStack(prot_stack); } prot_stack.init(); // Substitute vars with defined system props (if any) List<Protocol> prots=prot_stack.getProtocols(); Map<String,String> map=new HashMap<>(); for(Protocol prot: prots) Configurator.resolveAndAssignFields(prot, map); }
/** * Creates a channel from a list of protocols. Note that after a {@link org.jgroups.JChannel#close()}, the protocol * list <em>should not</em> be reused, ie. new JChannel(protocols) would reuse the same protocol list, and this * might lead to problems ! * @param protocols The list of protocols, from bottom to top, ie. the first protocol in the list is the transport, * the last the top protocol */ public JChannel(List<Protocol> protocols) throws Exception { prot_stack=new ProtocolStack().setChannel(this); for(Protocol prot: protocols) { prot_stack.addProtocol(prot); prot.setProtocolStack(prot_stack); } prot_stack.init(); // Substitute vars with defined system props (if any) List<Protocol> prots=prot_stack.getProtocols(); Map<String,String> map=new HashMap<>(); for(Protocol prot: prots) Configurator.resolveAndAssignFields(prot, map); }
/** * Adds a list of protocols * @param prots * @return * @since 2.11 */ public ProtocolStack addProtocols(Protocol ... prots) { if(prots != null) { for(Protocol prot: prots) addProtocol(prot); } return this; }
/** * Creates a channel from a list of protocols. Note that after a {@link org.jgroups.JChannel#close()}, the protocol * list <em>should not</em> be reused, ie. new JChannel(protocols) would reuse the same protocol list, and this * might lead to problems ! * @param protocols The list of protocols, from bottom to top, ie. the first protocol in the list is the transport, * the last the top protocol * @deprecated Use {@link JChannel#JChannel(List)} instead */ @Deprecated public JChannel(Collection<Protocol> protocols) throws Exception { prot_stack=new ProtocolStack().setChannel(this); for(Protocol prot: protocols) { prot_stack.addProtocol(prot); prot.setProtocolStack(prot_stack); } prot_stack.init(); // Substitute vars with defined system props (if any) List<Protocol> prots=prot_stack.getProtocols(); Map<String,String> map=new HashMap<>(); for(Protocol prot: prots) Configurator.resolveAndAssignFields(prot, map); }
/** * Creates a channel from a list of protocols. Note that after a {@link org.jgroups.JChannel#close()}, the protocol * list <em>should not</em> be reused, ie. new JChannel(protocols) would reuse the same protocol list, and this * might lead to problems ! * @param protocols The list of protocols, from bottom to top, ie. the first protocol in the list is the transport, * the last the top protocol */ public JChannel(List<Protocol> protocols) throws Exception { prot_stack=new ProtocolStack().setChannel(this); for(Protocol prot: protocols) { prot_stack.addProtocol(prot); prot.setProtocolStack(prot_stack); } prot_stack.init(); // Substitute vars with defined system props (if any) List<Protocol> prots=prot_stack.getProtocols(); Map<String,String> map=new HashMap<>(); for(Protocol prot: prots) Configurator.resolveAndAssignFields(prot, map); }
@Override protected void init() { try { if (this.channel == null) { this.channel = newChannel(jgroupsConfig); } ProtocolStack protocolStack = channel.getProtocolStack(); Protocol centralLock = protocolStack.findProtocol(CENTRAL_LOCK.class); if (centralLock == null) { // add the locking protocol CENTRAL_LOCK lockingProtocol = new CENTRAL_LOCK(); // we have to call init because the channel has already been created lockingProtocol.init(); protocolStack.addProtocol(lockingProtocol); } // Add a listener through which we'll know what's going on within the cluster ... this.channel.addChannelListener(listener); // Set the receiver through which we'll receive all of the changes ... this.channel.setReceiver(receiver); // Now connect to the cluster ... this.channel.connect(clusterName); } catch (Exception e) { throw new RuntimeException(e); } }
@Override protected void init() { try { if (this.channel == null) { this.channel = newChannel(jgroupsConfig); } ProtocolStack protocolStack = channel.getProtocolStack(); Protocol centralLock = protocolStack.findProtocol(CENTRAL_LOCK.class); if (centralLock == null) { // add the locking protocol CENTRAL_LOCK lockingProtocol = new CENTRAL_LOCK(); // we have to call init because the channel has already been created lockingProtocol.init(); protocolStack.addProtocol(lockingProtocol); } // Add a listener through which we'll know what's going on within the cluster ... this.channel.addChannelListener(listener); // Set the receiver through which we'll receive all of the changes ... this.channel.setReceiver(receiver); // Now connect to the cluster ... this.channel.connect(clusterName); } catch (Exception e) { throw new RuntimeException(e); } }
stack.addProtocol(relay); relay.init(); stack.addProtocol(fork); fork.init();
channel.getProtocolStack().addProtocol(fork); ForkChannel fch = new ForkChannel(channel, "stack1", "channel1"); CustomChannelLookup.registerChannel(gcb, fch, name, true);