i'm using Jetty 9 EndPoint for the first time.
But i'm stuck as to how to use the EndPoint.flush(ByteBuffer) method returncode.
Should i loop indefinitly until the call succeeds ?
Javadoc just says
Returns: True IFF all the buffers have been consumed and the endpoint has flushed the data to its destination (ie is not buffering any data).
By the way, the instance i'm calling on is of type SslConnection$DecryptedEndPoint
Any insight is appreciated, since i can't find any documentation as to why SocketEndpoint is discouraged and SelectChannelEndpoint is preferred.
A bit offtopic but anyway;
To my surprise i found this in NetworkTrafficSelectChannelEndPoint:
the operation |= is used instead of &= (found in jetty-all-9.0.3.v20130506-sources.jar)
@Override
public boolean flush(ByteBuffer... buffers) throws IOException
{
boolean flushed=true;
for (ByteBuffer b : buffers)
{
if (b.hasRemaining())
{
int position = b.position();
flushed|=super.flush(b); // <<-- shouldn't it be &=
int l=b.position()-position;
notifyOutgoing(b, position, l);
if (!flushed)
break;
}
}
return flushed;
}