protected Protocol createProtocol(String classname) throws Exception { String defaultProtocolName=ProtocolConfiguration.protocol_prefix + '.' + classname; Class<?> clazz=null; try { clazz=Util.loadClass(defaultProtocolName, getClass()); } catch(ClassNotFoundException e) { } if(clazz == null) { try { clazz=Util.loadClass(classname, getClass()); } catch(ClassNotFoundException e) { } if(clazz == null) { throw new Exception("unable to load class for protocol " + classname + " (either as an absolute - " + classname + " - or relative - " + defaultProtocolName + " - package name)"); } } Protocol retval=(Protocol)clazz.newInstance(); if(retval == null) throw new Exception("creation of instance for protocol " + classname + "failed"); retval.setProtocolStack(this); return retval; }
public void initProtocolStack() throws Exception { List<Protocol> protocols = getProtocols(); Collections.reverse(protocols); for(Protocol prot: protocols) { if(prot.getProtocolStack() == null) prot.setProtocolStack(this); callAfterCreationHook(prot, prot.afterCreationHook()); prot.init(); } }
for(Protocol prot: list) { Protocol new_prot=prot.getClass().newInstance(); new_prot.setProtocolStack(targetStack); retval.add(new_prot);
/** * 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); }
/** * Adds a protocol at the tail of the protocol list * @param prot * @return * @since 2.11 */ public ProtocolStack addProtocol(Protocol prot) { if(prot == null) return this; prot.setProtocolStack(this); prot.setUpProtocol(this); if(bottom_prot == null) { top_prot=bottom_prot=prot; return this; } prot.setDownProtocol(top_prot); prot.getDownProtocol().setUpProtocol(prot); top_prot=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 */ 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); }
retval=(Protocol)clazz.newInstance(); if(stack != null) retval.setProtocolStack(stack);
protected Protocol createProtocol(String classname) throws Exception { String defaultProtocolName=ProtocolConfiguration.protocol_prefix + '.' + classname; Class<?> clazz=null; try { clazz=Util.loadClass(defaultProtocolName, getClass()); } catch(ClassNotFoundException e) { } if(clazz == null) { try { clazz=Util.loadClass(classname, getClass()); } catch(ClassNotFoundException e) { } if(clazz == null) { throw new Exception("unable to load class for protocol " + classname + " (either as an absolute - " + classname + " - or relative - " + defaultProtocolName + " - package name)"); } } Protocol retval=(Protocol)clazz.newInstance(); if(retval == null) throw new Exception("creation of instance for protocol " + classname + "failed"); retval.setProtocolStack(this); return retval; }
retval.setProtocolStack(prot_stack); if(properties != null) if(!retval.setPropertiesInternal(properties))
for(Protocol prot: list) { Protocol new_prot=prot.getClass().newInstance(); new_prot.setProtocolStack(targetStack); retval.add(new_prot);
public void initProtocolStack() throws Exception { List<Protocol> protocols = getProtocols(); Collections.reverse(protocols); for(Protocol prot: protocols) { if(prot.getProtocolStack() == null) prot.setProtocolStack(this); callAfterCreationHook(prot, prot.afterCreationHook()); prot.init(); } }
/** * 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); }
/** * Adds a protocol at the tail of the protocol list * @param prot * @return * @since 2.11 */ public ProtocolStack addProtocol(Protocol prot) { if(prot == null) return this; prot.setProtocolStack(this); prot.setUpProtocol(this); if(bottom_prot == null) { top_prot=bottom_prot=prot; return this; } prot.setDownProtocol(top_prot); prot.getDownProtocol().setUpProtocol(prot); top_prot=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 */ 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); }
public void setProtocolStack(Protocol[] stack) { this.protStack=stack; this.protStack[0].setUpProtocol(ad); this.protStack[this.protStack.length-1].setDownProtocol(ad); top=protStack[0]; bottom=this.protStack[this.protStack.length-1]; prot_stack=new ProtocolStack(); if(protStack.length > 1) { for(int i=0; i < protStack.length; i++) { Protocol p1=protStack[i]; p1.setProtocolStack(prot_stack); Protocol p2=i+1 >= protStack.length? null : protStack[i+1]; if(p2 != null) { p1.setDownProtocol(p2); p2.setUpProtocol(p1); } } } }
retval=(Protocol)clazz.newInstance(); if(stack != null) retval.setProtocolStack(stack);