private void maybeAddToUnacknowledgedStanzas(Stanza stanza) throws IOException { // Check if the stream element should be put to the unacknowledgedStanza // queue. Note that we can not do the put() in sendStanzaInternal() and the // packet order is not stable at this point (sendStanzaInternal() can be // called concurrently). if (unacknowledgedStanzas != null && stanza != null) { // If the unacknowledgedStanza queue is nearly full, request an new ack // from the server in order to drain it if (unacknowledgedStanzas.size() == 0.8 * XMPPTCPConnection.QUEUE_SIZE) { writer.write(AckRequest.INSTANCE.toXML().toString()); writer.flush(); } try { // It is important the we put the stanza in the unacknowledged stanza // queue before we put it on the wire unacknowledgedStanzas.put(stanza); } catch (InterruptedException e) { throw new IllegalStateException(e); } } }
private void requestSmAcknowledgementInternal() throws NotConnectedException { packetWriter.sendStreamElement(AckRequest.INSTANCE); }
public static AckRequest ackRequest(XmlPullParser parser) throws XmlPullParserException, IOException { ParserUtils.assertAtStartTag(parser); parser.next(); ParserUtils.assertAtEndTag(parser); return AckRequest.INSTANCE; }
private void requestSmAcknowledgementInternal() throws NotConnectedException, InterruptedException { packetWriter.sendStreamElement(AckRequest.INSTANCE); }