Issue #3106 - changes from review, adding javadoc

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-03-28 12:20:30 +11:00 committed by Greg Wilkins
parent 45b2c548b0
commit 97ff7ed9c0
3 changed files with 17 additions and 0 deletions

View File

@ -62,6 +62,8 @@ public class Parser
private static final Logger LOG = Log.getLogger(Parser.class);
private final WebSocketPolicy policy;
private final ByteBufferPool bufferPool;
// Stats (where a message is defined as a WebSocket frame)
private final LongAdder messagesIn = new LongAdder();
private final LongAdder bytesIn = new LongAdder();

View File

@ -675,24 +675,36 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
setInitialBuffer(prefilled);
}
/**
* @return the number of WebSocket frames received over this connection
*/
@Override
public long getMessagesIn()
{
return parser.getMessagesIn();
}
/**
* @return the number of WebSocket frames sent over this connection
*/
@Override
public long getMessagesOut()
{
return flusher.getMessagesOut();
}
/**
* @return the number of bytes received over this connection
*/
@Override
public long getBytesIn()
{
return parser.getBytesIn();
}
/**
* @return the number of bytes frames sent over this connection
*/
@Override
public long getBytesOut()
{

View File

@ -53,8 +53,11 @@ public class FrameFlusher extends IteratingCallback
private final Deque<FrameEntry> queue = new ArrayDeque<>();
private final List<FrameEntry> entries;
private final List<ByteBuffer> buffers;
// Stats (where a message is defined as a WebSocket frame)
private final LongAdder messagesOut = new LongAdder();
private final LongAdder bytesOut = new LongAdder();
private boolean closed;
private boolean canEnqueue = true;
private Throwable terminated;