Package org.jgroups.stack

Examples of org.jgroups.stack.AckSenderWindow


        final short             send_conn_id;
        final Lock              lock=new ReentrantLock();

        public SenderEntry(short send_conn_id) {
            this.send_conn_id=send_conn_id;
            sent_msgs=new AckSenderWindow();
        }
View Full Code Here


    @DataProvider(name="provider")
    Object[][] provider() {
        final TimeScheduler timer=new DefaultTimeScheduler(10);
        return new Object[][] {
                {timer,
                 new AckSenderWindow(new MyRetransmitCommand(), new StaticInterval(xmit_timeouts), timer)}
        };
    }
View Full Code Here

     * @param highest_delivered
     * @param highest_seen
     */
    protected void stable(Address sender, long highest_delivered, long highest_seen) {
        SenderEntry entry=send_table.get(sender);
        AckSenderWindow win=entry != null? entry.sent_msgs : null;
        if(win == null)
            return;

        if(log.isTraceEnabled())
            log.trace(new StringBuilder().append(local_addr).append(" <-- STABLE(").append(sender).
                    append(": ").append(highest_delivered).append("-").append(highest_seen).append(')'));

        win.ack(highest_delivered);
        long win_high=win.getHighest();
        if(win_high > highest_seen) {
            for(long seqno=highest_seen; seqno <= win_high; seqno++) {
                Message msg=win.get(seqno); // destination is still the same (the member which sent the STABLE message)
                if(msg != null)
                    down_prot.down(new Event(Event.MSG, msg));
            }
        }
    }
View Full Code Here

        if(log.isTraceEnabled())
            log.trace(new StringBuilder().append(local_addr).append(" <-- XMIT(").append(sender).
                    append(": #").append(low).append( "-").append(high).append(')'));

        SenderEntry entry=send_table.get(sender);
        AckSenderWindow win=entry != null? entry.sent_msgs : null;
        if(win != null) {
            for(long i=low; i <= high; i++) {
                Message msg=win.get(i);
                if(msg == null) {
                    if(log.isWarnEnabled() && !local_addr.equals(sender)) {
                        StringBuilder sb=new StringBuilder();
                        sb.append("(requester=").append(sender).append(", local_addr=").append(this.local_addr);
                        sb.append(") message ").append(sender).append("::").append(i);
View Full Code Here

     */
    private void handleResendingOfFirstMessage(Address sender, long seqno) {
        if(log.isTraceEnabled())
            log.trace(local_addr + " <-- SEND_FIRST_SEQNO(" + sender + ")");
        SenderEntry entry=send_table.get(sender);
        AckSenderWindow win=entry != null? entry.sent_msgs : null;
        if(win == null) {
            if(log.isErrorEnabled())
                log.error(local_addr + ": sender window for " + sender + " not found");
            return;
        }
        long lowest=win.getLowest();
        Message rsp=win.get(lowest);
        if(rsp == null)
            return;

        // We need to copy the UnicastHeader and put it back into the message because Message.copy() doesn't copy
        // the headers and therefore we'd modify the original message in the sender retransmission window
        // (https://jira.jboss.org/jira/browse/JGRP-965)
        Message copy=rsp.copy();
        Unicast2Header hdr=(Unicast2Header)copy.getHeader(this.id);
        Unicast2Header newhdr=hdr.copy();
        newhdr.first=true;
        copy.putHeader(this.id, newhdr);

        if(log.isTraceEnabled()) {
            StringBuilder sb=new StringBuilder();
            sb.append(local_addr).append(" --> DATA(").append(copy.getDest()).append(": #").append(newhdr.seqno).
                    append(", conn_id=").append(newhdr.conn_id);
            if(newhdr.first) sb.append(", first");
            sb.append(')');
            log.trace(sb);
        }
        down_prot.down(new Event(Event.MSG, copy));

        if(++lowest > seqno)
            return;
        for(long i=lowest; i <= seqno; i++) {
            rsp=win.get(i);
            if(rsp != null)
                down_prot.down(new Event(Event.MSG, rsp));
        }
    }
View Full Code Here

    private void handleAckReceived(Address sender, long seqno) {
        if(log.isTraceEnabled())
            log.trace(new StringBuilder().append(local_addr).append(" <-- ACK(").append(sender).
                    append(": #").append(seqno).append(')'));
        SenderEntry entry=send_table.get(sender);
        AckSenderWindow win=entry != null? entry.sent_msgs : null;
        if(win != null) {
            win.ack(seqno); // removes message from retransmission
            num_acks_received++;
        }
    }
View Full Code Here

     */
    private void handleResendingOfFirstMessage(Address sender) {
        if(log.isTraceEnabled())
            log.trace(local_addr + " <-- SEND_FIRST_SEQNO(" + sender + ")");
        SenderEntry entry=send_table.get(sender);
        AckSenderWindow win=entry != null? entry.sent_msgs : null;
        if(win == null) {
            if(log.isErrorEnabled())
                log.error(local_addr + ": sender window for " + sender + " not found");
            return;
        }
        Message rsp=win.getLowestMessage();
        if(rsp == null)
            return;

        // We need to copy the UnicastHeader and put it back into the message because Message.copy() doesn't copy
        // the headers and therefore we'd modify the original message in the sender retransmission window
View Full Code Here

        final Lock              lock=new ReentrantLock();

        public SenderEntry(short send_conn_id, AckSenderWindow.RetransmitCommand cmd, long[] timeout,
                           TimeScheduler timer, Address local_addr) {
            this.send_conn_id=send_conn_id;
            sent_msgs=new AckSenderWindow(cmd, new StaticInterval(timeout), timer, local_addr);
        }
View Full Code Here

    /** Tests whether retransmits are called at correct times for 1000 messages */
    public void testRetransmits() {
  Entry entry;
  int   num_non_correct_entries=0;

  win=new AckSenderWindow(new MyRetransmitCommand(), xmit_timeouts);
 
  // 1. Send NUM_MSGS messages:
  System.out.println("-- sending " + NUM_MSGS + " messages:");
  for(long i=0; i < NUM_MSGS; i++) {
      msgs.put(new Long(i), new Entry());
View Full Code Here

                    try {
                        seqno=entry.sent_msgs_seqno;
                        UnicastHeader hdr=new UnicastHeader(UnicastHeader.DATA, seqno);
                        if(entry.sent_msgs == null) { // first msg to peer 'dst'
                            entry.sent_msgs=new AckSenderWindow(this, timeout, timer, this.local_addr); // use the protocol stack's timer
                        }
                        msg.putHeader(name, hdr);
                        if(trace)
                            log.trace(new StringBuffer().append(local_addr).append(" --> DATA(").append(dst).append(": #").
                                    append(seqno));
View Full Code Here

TOP

Related Classes of org.jgroups.stack.AckSenderWindow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.