public void init(TP transport) { this.tp=transport; this.tp_id=tp.getId(); this.log=tp.getLog(); }
protected int marshalMessagesToSameDestination(Address dest, Message[] buf, final int start_index, final int end_index, int max_bundle_size) throws Exception { int num_msgs=0, bytes=0; for(int i=start_index; i != end_index; i=increment(i)) { Message msg=buf[i]; if(msg != null && msg != NULL_MSG && Objects.equals(dest, msg.dest())) { long msg_size=msg.size(); if(bytes + msg_size > max_bundle_size) break; bytes+=msg_size; num_msgs++; buf[i]=NULL_MSG; msg.writeToNoAddrs(msg.src(), output, transport.getId()); } } return num_msgs; }
protected int marshalMessagesToSameDestination(Address dest, Message[] buf, int start_index, final int end_index, int max_bundle_size) throws Exception { int num_msgs=0, bytes=0; for(;;) { Message msg=buf[start_index]; if(msg != null && Objects.equals(dest, msg.dest())) { long size=msg.size(); if(bytes + size > max_bundle_size) break; bytes+=size; num_msgs++; buf[start_index]=null; msg.writeToNoAddrs(msg.src(), output, transport.getId()); } if(start_index == end_index) break; start_index=advance(start_index); } return num_msgs; }
protected int marshalMessagesToSameDestination(Address dest, Message[] buf, int start_index, int available_msgs, int max_bundle_size) throws Exception { int num_msgs=0, bytes=0; while(available_msgs > 0) { Message msg=buf[start_index]; if(msg != null && Objects.equals(dest, msg.dest())) { long msg_size=msg.size(); if(bytes + msg_size > max_bundle_size) break; bytes+=msg_size; num_msgs++; buf[start_index]=null; msg.writeToNoAddrs(msg.src(), output, transport.getId()); } available_msgs--; start_index=increment(start_index); } return num_msgs; }
public void up(MessageBatch batch) { // let unicast message batches pass if(batch.dest() != null && (batch.mode() == MessageBatch.Mode.OOB && batch.mode() == MessageBatch.Mode.INTERNAL) || holes.contains(batch.sender())) { up_prot.up(batch); return; } if(barrier_closed.get()) { final Map<Address,Message> map=batch.dest() == null? mcast_queue : ucast_queue; map.put(batch.sender(), batch.last().putHeader(transport.getId(),new TpHeader(batch.clusterName()))); return; // queue the last message of the batch and drop the batch } Thread current_thread=Thread.currentThread(); in_flight_threads.put(current_thread, NULL); try { up_prot.up(batch); } finally { unblock(current_thread); } }
protected void sendMessageList(final Address dest, final Address src, final List<Message> list) { try { Util.writeMessageList(dest, src, transport.cluster_name.chars(), list, output, dest == null, transport.getId()); transport.doSend(output.buffer(), 0, output.position(), dest); } catch(SocketException | SocketTimeoutException sock_ex) { log.debug(Util.getMessage("FailureSendingMsgBundle"), transport.localAddress(),sock_ex); } catch(Throwable e) { log.error(Util.getMessage("FailureSendingMsgBundle"), transport.localAddress(), e); } }
msg.writeToNoAddrs(msg.getSrc(), output, transport.getId()); msg_queue[i]=null;
public void init(TP transport) { this.tp=transport; this.tp_id=tp.getId(); this.log=tp.getLog(); }
protected int marshalMessagesToSameDestination(Address dest, Message[] buf, final int start_index, final int end_index, int max_bundle_size) throws Exception { int num_msgs=0, bytes=0; for(int i=start_index; i != end_index; i=increment(i)) { Message msg=buf[i]; if(msg != null && msg != NULL_MSG && Objects.equals(dest, msg.dest())) { long msg_size=msg.size(); if(bytes + msg_size > max_bundle_size) break; bytes+=msg_size; num_msgs++; buf[i]=NULL_MSG; msg.writeToNoAddrs(msg.src(), output, transport.getId()); } } return num_msgs; }
protected int marshalMessagesToSameDestination(Address dest, Message[] buf, int start_index, int available_msgs, int max_bundle_size) throws Exception { int num_msgs=0, bytes=0; while(available_msgs > 0) { Message msg=buf[start_index]; if(msg != null && Objects.equals(dest, msg.dest())) { long msg_size=msg.size(); if(bytes + msg_size > max_bundle_size) break; bytes+=msg_size; num_msgs++; buf[start_index]=null; msg.writeToNoAddrs(msg.src(), output, transport.getId()); } available_msgs--; start_index=increment(start_index); } return num_msgs; }
protected int marshalMessagesToSameDestination(Address dest, Message[] buf, int start_index, final int end_index, int max_bundle_size) throws Exception { int num_msgs=0, bytes=0; for(;;) { Message msg=buf[start_index]; if(msg != null && Objects.equals(dest, msg.dest())) { long size=msg.size(); if(bytes + size > max_bundle_size) break; bytes+=size; num_msgs++; buf[start_index]=null; msg.writeToNoAddrs(msg.src(), output, transport.getId()); } if(start_index == end_index) break; start_index=advance(start_index); } return num_msgs; }
public void up(MessageBatch batch) { // let unicast message batches pass if(batch.dest() != null && (batch.mode() == MessageBatch.Mode.OOB && batch.mode() == MessageBatch.Mode.INTERNAL) || holes.contains(batch.sender())) { up_prot.up(batch); return; } if(barrier_closed.get()) { final Map<Address,Message> map=batch.dest() == null? mcast_queue : ucast_queue; map.put(batch.sender(), batch.last().putHeader(transport.getId(),new TpHeader(batch.clusterName()))); return; // queue the last message of the batch and drop the batch } Thread current_thread=Thread.currentThread(); in_flight_threads.put(current_thread, NULL); try { up_prot.up(batch); } finally { unblock(current_thread); } }
protected void sendMessageList(final Address dest, final Address src, final List<Message> list) { try { Util.writeMessageList(dest, src, transport.cluster_name.chars(), list, output, dest == null, transport.getId()); transport.doSend(output.buffer(), 0, output.position(), dest); } catch(SocketException | SocketTimeoutException sock_ex) { log.debug(Util.getMessage("FailureSendingMsgBundle"), transport.localAddress(),sock_ex); } catch(Throwable e) { log.error(Util.getMessage("FailureSendingMsgBundle"), transport.localAddress(), e); } }
msg.writeToNoAddrs(msg.getSrc(), output, transport.getId()); msg_queue[i]=null;