@Override public void onAcknowledgement() { synchronized (exchange) { ObserveRelation relation = exchange.getRelation(); final Response next = relation.getNextControlNotification(); relation.setCurrentControlNotification(next); // next may be null relation.setNextControlNotification(null); if (next != null) { LOGGER.fine("Notification has been acknowledged, send the next one"); /* * The matcher must be able to find the NON notifications to remove * them from the exchangesByMID hashmap */ if (next.getType() == Type.NON) { relation.addNotification(next); } // Create a new task for sending next response so that we // can leave the sync-block executor.execute(new Runnable() { public void run() { ObserveLayer.super.sendResponse(exchange, next); } }); } } }
@Override public void onAcknowledgement() { synchronized (exchange) { ObserveRelation relation = exchange.getRelation(); final Response next = relation.getNextControlNotification(); relation.setCurrentControlNotification(next); // next may be null relation.setNextControlNotification(null); if (next != null) { LOGGER.fine("Notification has been acknowledged, send the next one"); /* * The matcher must be able to find the NON notifications to remove * them from the exchangesByMID hashmap */ if (next.getType() == Type.NON) { relation.addNotification(next); } // Create a new task for sending next response so that we can leave the sync-block executor.execute(new Runnable() { public void run() { ObserveLayer.super.sendResponse(exchange, next); } }); } } }
@Override public void onRetransmission() { synchronized (exchange) { ObserveRelation relation = exchange.getRelation(); final Response next = relation.getNextControlNotification(); if (next != null) { LOGGER.fine("The notification has timed out and there is a fresher notification for the retransmission"); // Cancel the original retransmission and send the fresh // notification here response.cancel(); // Convert all notification retransmissions to CON if (next.getType() != Type.CON) { next.setType(Type.CON); prepareSelfReplacement(exchange, next); } relation.setCurrentControlNotification(next); relation.setNextControlNotification(null); // Create a new task for sending next response so that we // can leave the sync-block executor.execute(new Runnable() { public void run() { ObserveLayer.super.sendResponse(exchange, next); } }); } } }
@Override public void onRetransmission() { synchronized (exchange) { ObserveRelation relation = exchange.getRelation(); final Response next = relation.getNextControlNotification(); if (next != null) { LOGGER.fine("The notification has timed out and there is a fresher notification for the retransmission"); // Cancel the original retransmission and send the fresh notification here response.cancel(); // Convert all notification retransmissions to CON if (next.getType() != Type.CON) { next.setType(Type.CON); prepareSelfReplacement(exchange, next); } relation.setCurrentControlNotification(next); relation.setNextControlNotification(null); // Create a new task for sending next response so that we can leave the sync-block executor.execute(new Runnable() { public void run() { ObserveLayer.super.sendResponse(exchange, next); } }); } } }