public void run() { try { barrier.await(); } catch(Exception e) { e.printStackTrace(); return; } for(;;) { try { int tmp=num_msgs_sent.incrementAndGet(); if(tmp > num_msgs) break; long new_seqno=seqno.getAndIncrement(); invokeRpc(handleData, send_options, local_addr, payload, new_seqno, num_threads == 1); if(tmp % log_interval == 0) System.out.println("++ sent " + tmp); if(tmp == num_msgs) { // last message, send SENDING_DONE message RequestOptions opts=RequestOptions.ASYNC().flags(Message.Flag.RSVP); invokeRpc(sendingDone, opts, local_addr); } } catch(Exception e) { } } } }
public void start(String props, String name) throws Exception { this.props=props; this.name=name; StringBuilder sb=new StringBuilder(); sb.append("\n\n----------------------- MPerf -----------------------\n"); sb.append("Date: ").append(new Date()).append('\n'); sb.append("Run by: ").append(System.getProperty("user.name")).append("\n"); sb.append("JGroups version: ").append(Version.description).append('\n'); System.out.println(sb); channel=new JChannel(props); channel.setName(name); disp=new RpcDispatcher(channel, this).setMembershipListener(this).setMethodLookup(id -> METHODS[id]) .setMarshaller(new MperfMarshaller()); send_options.mode(sync? ResponseMode.GET_ALL : ResponseMode.GET_NONE); if(oob) send_options.flags(Message.Flag.OOB); channel.connect("mperf"); local_addr=channel.getAddress(); JmxConfigurator.registerChannel(channel, Util.getMBeanServer(), "jgroups", "mperf", true); // send a CONFIG_REQ to the current coordinator, so we can get the current config Address coord=channel.getView().getCoord(); if(coord != null && !local_addr.equals(coord)) invokeRpc(configReq, coord, RequestOptions.ASYNC().flags(Message.Flag.RSVP), local_addr); }
public void configReq(Address sender) throws Exception { // 6 Configuration cfg=new Configuration(); cfg.addChange("num_msgs", num_msgs); cfg.addChange("msg_size", msg_size); cfg.addChange("num_threads", num_threads); cfg.addChange("num_senders", num_senders); cfg.addChange("sync", sync); cfg.addChange("oob", oob); invokeRpc(configRsp, sender, RequestOptions.ASYNC(), cfg); }
public void run() { try { barrier.await(); } catch(Exception e) { e.printStackTrace(); return; } for(;;) { try { int tmp=num_msgs_sent.incrementAndGet(); if(tmp > num_msgs) break; long new_seqno=seqno.getAndIncrement(); invokeRpc(handleData, send_options, local_addr, payload, new_seqno, num_threads == 1); if(tmp % log_interval == 0) System.out.println("++ sent " + tmp); if(tmp == num_msgs) { // last message, send SENDING_DONE message RequestOptions opts=RequestOptions.ASYNC().flags(Message.Flag.RSVP); invokeRpc(sendingDone, opts, local_addr); } } catch(Exception e) { } } } }
public void start(String props, String name) throws Exception { this.props=props; this.name=name; StringBuilder sb=new StringBuilder(); sb.append("\n\n----------------------- MPerf -----------------------\n"); sb.append("Date: ").append(new Date()).append('\n'); sb.append("Run by: ").append(System.getProperty("user.name")).append("\n"); sb.append("JGroups version: ").append(Version.description).append('\n'); System.out.println(sb); channel=new JChannel(props); channel.setName(name); disp=new RpcDispatcher(channel, this).setMembershipListener(this).setMethodLookup(id -> METHODS[id]) .setMarshaller(new MperfMarshaller()); send_options.mode(sync? ResponseMode.GET_ALL : ResponseMode.GET_NONE); if(oob) send_options.flags(Message.Flag.OOB); channel.connect("mperf"); local_addr=channel.getAddress(); JmxConfigurator.registerChannel(channel, Util.getMBeanServer(), "jgroups", "mperf", true); // send a CONFIG_REQ to the current coordinator, so we can get the current config Address coord=channel.getView().getCoord(); if(coord != null && !local_addr.equals(coord)) invokeRpc(configReq, coord, RequestOptions.ASYNC().flags(Message.Flag.RSVP), local_addr); }
public void configReq(Address sender) throws Exception { // 6 Configuration cfg=new Configuration(); cfg.addChange("num_msgs", num_msgs); cfg.addChange("msg_size", msg_size); cfg.addChange("num_threads", num_threads); cfg.addChange("num_senders", num_senders); cfg.addChange("sync", sync); cfg.addChange("oob", oob); invokeRpc(configRsp, sender, RequestOptions.ASYNC(), cfg); }
@Override public void send(final Buffer data, final boolean synchronous, final long timeout) throws Exception { final RequestOptions options = synchronous ? RequestOptions.SYNC() : RequestOptions.ASYNC(); options.exclusionList( dispatcher.getChannel().getAddress() ); options.setTransientFlags( TransientFlag.DONT_LOOPBACK ); options.setTimeout( timeout ); if ( synchronous ) { try { RspList<Object> rspList = dispatcher.castMessage( null, data, options ); handleResponseProblems( rspList, null ); } catch (Exception e) { throw log.unableToSendWorkViaJGroups( e ); } } else { try { dispatcher.castMessageWithFuture( null, data, options ); } catch (RuntimeException e) { throw log.unableToSendWorkViaJGroups( e ); } } }