/** * Called from the {@link Sender} to remove information from the control packet dispatcher. * * @param publication to remove */ public void unregisterForSend(final NetworkPublication publication) { publicationBySessionAndStreamId.remove(publication.sessionId(), publication.streamId()); }
/** * Called to indicate a retransmission is received that may obviate the need to send one ourselves. * <p> * NOTE: Currently only called from unit tests. Would be used for retransmitting from receivers for NAK suppression * * @param termId of the data * @param termOffset of the data */ public void onRetransmitReceived(final int termId, final int termOffset) { final RetransmitAction action = activeRetransmitsMap.get(termId, termOffset); if (null != action && DELAYED == action.state) { activeRetransmitsMap.remove(termId, termOffset); action.cancel(); // do not go into linger } }
/** * Called to process any outstanding timeouts. * * @param nowNs time in nanoseconds * @param retransmitSender to call on retransmissions */ public void processTimeouts(final long nowNs, final RetransmitSender retransmitSender) { if (activeRetransmitsMap.size() > 0) { for (final RetransmitAction action : retransmitActionPool) { if (DELAYED == action.state && (action.expireNs - nowNs < 0)) { retransmitSender.resend(action.termId, action.termOffset, action.length); action.linger(determineLingerTimeout(), nanoClock.nanoTime()); } else if (LINGERING == action.state && (action.expireNs - nowNs < 0)) { action.cancel(); activeRetransmitsMap.remove(action.termId, action.termOffset); } } } }
@Test public void shouldRemoveItem() { final String testValue = "Test"; final int keyPartA = 3; final int keyPartB = 7; map.put(keyPartA, keyPartB, testValue); assertThat(map.remove(keyPartA, keyPartB), is(testValue)); assertNull(map.get(keyPartA, keyPartB)); }
/** * Called from the {@link Sender} to remove information from the control packet dispatcher. * * @param publication to remove */ public void unregisterForSend(final NetworkPublication publication) { publicationBySessionAndStreamId.remove(publication.sessionId(), publication.streamId()); }
/** * Called from the {@link Sender} to remove information from the control packet dispatcher. * * @param publication to remove */ public void unregisterForSend(final NetworkPublication publication) { publicationBySessionAndStreamId.remove(publication.sessionId(), publication.streamId()); }
/** * Called to indicate a retransmission is received that may obviate the need to send one ourselves. * <p> * NOTE: Currently only called from unit tests. Would be used for retransmitting from receivers for NAK suppression * * @param termId of the data * @param termOffset of the data */ public void onRetransmitReceived(final int termId, final int termOffset) { final RetransmitAction action = activeRetransmitsMap.get(termId, termOffset); if (null != action && DELAYED == action.state) { activeRetransmitsMap.remove(termId, termOffset); action.cancel(); // do not go into linger } }
/** * Called to indicate a retransmission is received that may obviate the need to send one ourselves. * <p> * NOTE: Currently only called from unit tests. Would be used for retransmitting from receivers for NAK suppression * * @param termId of the data * @param termOffset of the data */ public void onRetransmitReceived(final int termId, final int termOffset) { final RetransmitAction action = activeRetransmitsMap.get(termId, termOffset); if (null != action && DELAYED == action.state) { activeRetransmitsMap.remove(termId, termOffset); action.cancel(); // do not go into linger } }
/** * Called to process any outstanding timeouts. * * @param nowNs time in nanoseconds * @param retransmitSender to call on retransmissions */ public void processTimeouts(final long nowNs, final RetransmitSender retransmitSender) { if (activeRetransmitsMap.size() > 0) { for (final RetransmitAction action : retransmitActionPool) { if (DELAYED == action.state && (action.expireNs - nowNs < 0)) { retransmitSender.resend(action.termId, action.termOffset, action.length); action.linger(determineLingerTimeout(), nanoClock.nanoTime()); } else if (LINGERING == action.state && (action.expireNs - nowNs < 0)) { action.cancel(); activeRetransmitsMap.remove(action.termId, action.termOffset); } } } }
/** * Called to process any outstanding timeouts. * * @param nowNs time in nanoseconds * @param retransmitSender to call on retransmissions */ public void processTimeouts(final long nowNs, final RetransmitSender retransmitSender) { if (activeRetransmitsMap.size() > 0) { for (final RetransmitAction action : retransmitActionPool) { if (DELAYED == action.state && (action.expireNs - nowNs < 0)) { retransmitSender.resend(action.termId, action.termOffset, action.length); action.linger(determineLingerTimeout(), nanoClock.nanoTime()); } else if (LINGERING == action.state && (action.expireNs - nowNs < 0)) { action.cancel(); activeRetransmitsMap.remove(action.termId, action.termOffset); } } } }