MCPcopy Create free account
hub / github.com/e2wugui/zeze / checkOverflow

Method checkOverflow

ZezeJava/ZezeJava/src/main/java/Zeze/Net/Service.java:573–585  ·  view source on GitHub ↗
(@NotNull AsyncSocket so, long newSize, byte @NotNull [] bytes, int offset, int length)

Source from the content-addressed store, hash-verified

571 }
572
573 @SuppressWarnings("RedundantThrows")
574 public boolean checkOverflow(@NotNull AsyncSocket so, long newSize, byte @NotNull [] bytes, int offset, int length)
575 throws Exception {
576 var maxSize = getSocketOptions().getOutputBufferMaxSize();
577 if (newSize <= maxSize)
578 return true;
579 overflowSizeHandle.getAndAdd(this, (long)length);
580 if ((int)overflowCountHandle.getAndAdd(this, 1) == 0) {
581 Task.scheduleUnsafe(1000, () -> logger.error("Send overflow(>{}): {} dropped {}/{}",
582 maxSize, this, overflowSizeHandle.getAndSet(this, 0L), overflowCountHandle.getAndSet(this, 0)));
583 }
584 return false;
585 }
586
587 ////////////////////////////////////////////////////////////////////////////////////////////////
588

Callers 2

SendMethod · 0.80
SendSharedMethod · 0.80

Calls 3

getSocketOptionsMethod · 0.95
scheduleUnsafeMethod · 0.95

Tested by

no test coverage detected