Java 类org.jivesoftware.smack.sm.packet.StreamManagement.AckRequest 实例源码

项目:androidclient    文件:XMPPTCPConnection.java   
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);
        }
    }
}
项目:Smack    文件:XMPPTCPConnection.java   
private void requestSmAcknowledgementInternal() throws NotConnectedException {
    packetWriter.sendStreamElement(AckRequest.INSTANCE);
}
项目:Smack    文件:ParseStreamManagement.java   
public static AckRequest ackRequest(XmlPullParser parser) throws XmlPullParserException, IOException {
    ParserUtils.assertAtStartTag(parser);
    parser.next();
    ParserUtils.assertAtEndTag(parser);
    return AckRequest.INSTANCE;
}
项目:androidclient    文件:XMPPTCPConnection.java   
private void requestSmAcknowledgementInternal() throws NotConnectedException, InterruptedException {
    packetWriter.sendStreamElement(AckRequest.INSTANCE);
}