Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

Connection#addPacketSendingListener Javadoc is confusing/misleading

$
0
0

The Javadoc states that:

 

"Note that the thread that writes packets will be used to invoke the listeners."

 

If you know the Smack internals you will know that there exists a dedicated writer thread.

 

If you just look at the PacketWriter class you will discover that the "sending/writer" thread

is the thread that just called Connection#sendPacket(...)  and so it will be responsible for the

invocation of the listener callbacks.

 

It is just a little bit confusing


 

Furthermoore the Javadoc reads:

 

"The listener will be notified of every packet that this connection sends."

 

This is not true. The listener will be notified about every packet that the connection is about to send, because

calling XMPPConnection#sendPacket(...) will just add the packet to the internal buffer. Afterwards it is still possible

the the connection will break and so this packet will never hits the wire at all.



BR

 



Viewing all articles
Browse latest Browse all 10742

Trending Articles