Re: [jgroups-users] upgrading to 3.6.8

Questions/problems related to using JGroups <[email protected]>
Newsgroups gmane.comp.java.javagroups.general
Message-ID <[email protected]>
This is a bug, I'm changing this as we speak on 3.6 and master. There's 
a hacky workaround below, which uses MPING to create the stack but then 
replaces MPING with TCPPING before connecting to the cluster.


       MPING mping=new MPING();

         JChannel ch=new JChannel(
           new TCP()
             .setValue("oob_thread_pool_keep_alive_time", 5000)
             .setValue("timer_keep_alive_time", 3000)
             .setValue("bind_addr", InetAddress.getByName("127.0.0.1"))
             .setValue("bind_port", 7800)
             .setValue("thread_pool_min_threads", 1)
             .setValue("thread_pool_keep_alive_time", 5000)
             .setValue("send_buf_size", 640000)
             .setValue("oob_thread_pool_queue_max_size", 100)
             .setValue("oob_thread_pool_max_threads", 8)
             .setValue("thread_pool_queue_enabled", false)
             .setValue("sock_conn_timeout", 300)
             .setValue("oob_thread_pool_min_threads", 1)
             .setValue("loopback", false)
             .setValue("oob_thread_pool_queue_enabled", false)
             .setValue("max_bundle_timeout", 30)
             .setValue("thread_pool_queue_max_size", 100)
             .setValue("recv_buf_size", 5000000),
           mping,
           new MERGE3()
             .setValue("min_interval", 10000)
             .setValue("max_interval", 30000),
           new FD_SOCK(),
           new FD_ALL2()
             .setValue("timeout", 30 * 1000L),
         new VERIFY_SUSPECT()
           .setValue("timeout", 1500),
           new BARRIER(),
           new NAKACK2()
             .setValue("use_mcast_xmit", false),
           new UNICAST3(),
           new STABLE()
             .setValue("desired_avg_gossip", 50000)
             .setValue("max_bytes", 4000000)
             .setValue("stability_delay", 1000),
         new GMS()
           .setValue("join_timeout", 3000),
           new MFC()
             .setValue("max_credits", 2000000)
             .setValue("min_credits", 800000),
           new FRAG2(),
           new STATE_TRANSFER()
         );

         ch.getProtocolStack().replaceProtocol(mping, new 
TCPPING().setValue("initial_hosts", create()));

         ch.connect("demo");
     }


On 31/03/16 17:43, Questions/problems related to using JGroups wrote:
>>
>
>     > - Use new JChannel(Protocol ... protocols) constructor.
>
>
> Am unable to create my channel now, and wonder if it's a problem with
> the way I'm using the JChannel constructor or something.
>
> The problem I'm seeing is:
>
> --- begin ---
> java.lang.Exception: Property assignment of initial_hosts in TCPPING
> with original property value null and converted to null could not be
> assigned
>      at
> org.jgroups.stack.Configurator.resolveAndAssignField(Configurator.java:1154)
>      at
> org.jgroups.stack.Configurator.resolveAndAssignFields(Configurator.java:1119)
>      at org.jgroups.JChannel.<init>(JChannel.java:196)
>      at org.jgroups.JChannel.<init>(JChannel.java:172)
>      at
> com.enterprisedb.efm.Environment.createJChannel(Environment.java:390)
>      at com.enterprisedb.efm.nodes.EfmNode.doStartup(EfmNode.java:1032)
>      at com.enterprisedb.efm.nodes.EfmAgent.run(EfmAgent.java:161)
>      at
> com.enterprisedb.efm.main.ServiceCommand.main(ServiceCommand.java:112)
> Caused by: java.lang.Exception: Conversion of initial_hosts in TCPPING
> with original property value null failed
>      at
> org.jgroups.conf.PropertyHelper.getConvertedValue(PropertyHelper.java:88)
>      at
> org.jgroups.stack.Configurator.resolveAndAssignField(Configurator.java:1148)
>      ... 7 more
> Caused by: java.lang.NullPointerException
>      at java.util.StringTokenizer.<init>(StringTokenizer.java:199)
>      at java.util.StringTokenizer.<init>(StringTokenizer.java:221)
>      at org.jgroups.util.Util.parseCommaDelimitedHosts(Util.java:2717)
>      at
> org.jgroups.conf.PropertyConverters$InitialHosts.convert(PropertyConverters.java:71)
>      at
> org.jgroups.conf.PropertyHelper.getConvertedValue(PropertyHelper.java:85)
>      ... 8 more
> --- end ---
>
> I thought maybe I wasn't creating the list properly to set on TCPPING,
> but it looks ok to me. When I step through this code in
> org.jgroups.stack.Configurator:
>
>      public static void resolveAndAssignFields(Object obj,
> Map<String,String> props) throws Exception {
>          //traverse class hierarchy and find all annotated fields
>          for(Class<?> clazz=obj.getClass(); clazz != null;
> clazz=clazz.getSuperclass()) {
>              Field[] fields=clazz.getDeclaredFields();
>              for(Field field: fields)
>                  resolveAndAssignField(obj, field, props) ;
>          }
>      }
>
> ...I see that the 'props' map is always empty, which is what causes the
> problem. It's empty because of this constructor:
>
>      public JChannel(Collection<Protocol> protocols) throws Exception {
>          prot_stack=new ProtocolStack();
>          setProtocolStack(prot_stack);
>          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);
>      }
>
> So I don't see how this can ever work, but am not really following
> what's going on. Is there something wrong in the way I'm creating the
> channel? This is the code I'm using:
>
>          return new JChannel(
>              new TCP()
>                  .setValue("oob_thread_pool_keep_alive_time", 5000)
>                  .setValue("timer_keep_alive_time", 3000)
>                  .setValue("bind_addr", InetAddress.getByName(<get
> address>))
>                  .setValue("bind_port", bindingPort)
>                  .setValue("thread_pool_min_threads", 1)
>                  .setValue("thread_pool_keep_alive_time", 5000)
>                  .setValue("send_buf_size", 640000)
>                  .setValue("oob_thread_pool_queue_max_size", 100)
>                  .setValue("oob_thread_pool_max_threads", 8)
>                  .setValue("thread_pool_queue_enabled", false)
>                  .setValue("sock_conn_timeout", 300)
>                  .setValue("oob_thread_pool_min_threads", 1)
>                  .setValue("loopback", false)
>                  .setValue("oob_thread_pool_queue_enabled", false)
>                  .setValue("max_bundle_timeout", 30)
>                  .setValue("thread_pool_queue_max_size", 100)
>                  .setValue("recv_buf_size", 5000000),
>              new TCPPING()
>                  .setValue("initial_hosts", <create List<IpAddress>
> object>),
>              new MERGE3()
>                  .setValue("min_interval", 10000)
>                  .setValue("max_interval", 30000),
>              new FD_SOCK(),
>              new FD_ALL2()
>                  .setValue("timeout", <get timeout in sec> * 1000L),
>              new VERIFY_SUSPECT()
>                  .setValue("timeout", 1500),
>              new BARRIER(),
>              new NAKACK2()
>                  .setValue("use_mcast_xmit", false),
>              new UNICAST3(),
>              new STABLE()
>                  .setValue("desired_avg_gossip", 50000)
>                  .setValue("max_bytes", 4000000)
>                  .setValue("stability_delay", 1000),
>              createAuthProtocol(....),
>              new GMS()
>                  .setValue("join_timeout", 3000),
>              new MFC()
>                  .setValue("max_credits", 2000000)
>                  .setValue("min_credits", 800000),
>              new FRAG2(),
>              new STATE_TRANSFER()
>          );
>
> Thanks,
> Bobby
>
>
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
>
>
>
> _______________________________________________
> javagroups-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/javagroups-users
>

-- 
Bela Ban, JGroups lead (http://www.jgroups.org)


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.