1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Rename processPacket to processStanza

and assert that 'stanza' is a Stanza.
This commit is contained in:
Florian Schmaus 2015-06-05 14:04:17 +02:00
parent 1cd268a8f0
commit 2f219c7317
11 changed files with 33 additions and 44 deletions

View file

@ -981,7 +981,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
ParserUtils.assertAtEndTag(parser);
if (stanza != null) {
processPacket(stanza);
processStanza(stanza);
}
}
@ -990,29 +990,18 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* stanza(/packet) collectors and listeners and letting them examine the stanza(/packet) to see if
* they are a match with the filter.
*
* @param packet the stanza(/packet) to process.
* @param stanza the stanza to process.
*/
protected void processPacket(Stanza packet) {
assert(packet != null);
protected void processStanza(final Stanza stanza) {
assert(stanza != null);
lastStanzaReceived = System.currentTimeMillis();
// Deliver the incoming packet to listeners.
executorService.submit(new ListenerNotification(packet));
}
/**
* A runnable to notify all listeners and stanza(/packet) collectors of a packet.
*/
private class ListenerNotification implements Runnable {
private final Stanza packet;
public ListenerNotification(Stanza packet) {
this.packet = packet;
}
public void run() {
invokePacketCollectorsAndNotifyRecvListeners(packet);
}
executorService.submit(new Runnable() {
@Override
public void run() {
invokePacketCollectorsAndNotifyRecvListeners(stanza);
}
});
}
/**

View file

@ -44,7 +44,7 @@ import org.jxmpp.stringprep.XmppStringprepException;
* used to retrieve a message that was generated by the client.
*
* Packets that should be processed by the client to simulate a received stanza
* can be delivered using the {@linkplain #processPacket(Stanza)} method.
* can be delivered using the {@linkplain #processStanza(Stanza)} method.
* It invokes the registered stanza(/packet) interceptors and listeners.
*
* @see XMPPConnection
@ -178,7 +178,7 @@ public class DummyConnection extends AbstractXMPPConnection {
*
* @param packet the stanza(/packet) to process.
*/
public void processPacket(Stanza packet) {
public void processStanza(Stanza packet) {
invokePacketCollectorsAndNotifyRecvListeners(packet);
}

View file

@ -68,7 +68,7 @@ public class ThreadedDummyConnection extends DummyConnection {
/**
* Calling this method will cause the next sendStanza call with an IQ stanza(/packet) to timeout.
* This is accomplished by simply stopping the auto creating of the reply stanza(/packet)
* or processing one that was entered via {@link #processPacket(Stanza)}.
* or processing one that was entered via {@link #processStanza(Stanza)}.
*/
public void setTimeout() {
timeout = true;
@ -99,7 +99,7 @@ public class ThreadedDummyConnection extends DummyConnection {
@Override
public void run() {
try {
processPacket(processQ.take());
processStanza(processQ.take());
} catch (InterruptedException e) {
LOGGER.log(Level.WARNING, "exception", e);
}