Package org.jgroups.stack

Examples of org.jgroups.stack.AckSenderWindow



    /** Add the ACK to hashtable.sender.sent_msgs */
    private void handleAckReceived(Address sender, long seqno) {
        Entry           entry;
        AckSenderWindow win;

        if(log.isTraceEnabled())
            log.trace(new StringBuilder().append(local_addr).append(" <-- ACK(").append(sender).
                    append(": #").append(seqno).append(')'));
        synchronized(connections) {
            entry=connections.get(sender);
        }
        if(entry == null || entry.sent_msgs == null)
            return;
        win=entry.sent_msgs;
        win.ack(seqno); // removes message from retransmission
        num_acks_received++;
    }
View Full Code Here


     * We need to resend our first message with our conn_id
     * @param sender
     */
    private void handleResendingOfFirstMessage(Address sender) {
        Entry entry;
        AckSenderWindow sender_win;
        Message rsp;
        if(log.isTraceEnabled())
            log.trace(local_addr + " <-- SEND_FIRST_SEQNO(" + sender + ")");

        synchronized(connections) {
            entry=connections.get(sender);
            sender_win=entry != null? entry.sent_msgs : null;
            if(sender_win == null) {
                if(log.isErrorEnabled())
                    log.error(local_addr + ": sender window for " + sender + " not found");
                return;
            }
            rsp=sender_win.getLowestMessage();
        }
        if(rsp == null) {
            //if(log.isWarnEnabled())
            // log.warn("didn't find any messages in my sender window for " + sender);
            return;
View Full Code Here

                    try {
                        seqno=entry.sent_msgs_seqno;
                        if(seqno == DEFAULT_FIRST_SEQNO) // only happens on the first message
                            entry.send_conn_id=getNewConnectionId();
                        if(entry.sent_msgs == null) // first msg to peer 'dst'
                            entry.sent_msgs=new AckSenderWindow(this, new StaticInterval(timeout), timer, this.local_addr);
                        UnicastHeader hdr=new UnicastHeader(UnicastHeader.DATA, seqno, entry.send_conn_id,
                                                            seqno == DEFAULT_FIRST_SEQNO);
                        msg.putHeader(name, hdr);
                        if(log.isTraceEnabled()) {
                            StringBuilder sb=new StringBuilder();
View Full Code Here


    /** Add the ACK to hashtable.sender.sent_msgs */
    private void handleAckReceived(Address sender, long seqno) {
        Entry           entry;
        AckSenderWindow win;

        if(log.isTraceEnabled())
            log.trace(new StringBuilder().append(local_addr).append(" <-- ACK(").append(sender).
                    append(": #").append(seqno).append(')'));
        synchronized(connections) {
            entry=connections.get(sender);
        }
        if(entry == null || entry.sent_msgs == null)
            return;
        win=entry.sent_msgs;
        win.ack(seqno); // removes message from retransmission
        num_acks_received++;
    }
View Full Code Here

     * We need to resend our first message with our conn_id
     * @param sender
     */
    private void handleResendingOfFirstMessage(Address sender) {
        Entry entry;
        AckSenderWindow sender_win;
        Message rsp;
        if(log.isTraceEnabled())
            log.trace(local_addr + " <-- SEND_FIRST_SEQNO(" + sender + ")");

        synchronized(connections) {
            entry=connections.get(sender);
            sender_win=entry != null? entry.sent_msgs : null;
            if(sender_win == null) {
                if(log.isErrorEnabled())
                    log.error("sender window for " + sender + " not found");
                return;
            }
            rsp=sender_win.getLowestMessage();
        }
        if(rsp == null) {
            //if(log.isWarnEnabled())
                // log.warn("didn't find any messages in my sender window for " + sender);
            return;
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(long 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


    protected void setUp() throws Exception {
        super.setUp();
        timer=new TimeScheduler(10);
        win=new AckSenderWindow(null, new StaticInterval(xmit_timeouts), timer);
    }
View Full Code Here

     */
    public void testRetransmits() {
        Entry entry;
        int num_non_correct_entries=0;

        win=new AckSenderWindow(new MyRetransmitCommand(), new StaticInterval(xmit_timeouts), timer);

        // 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

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.