@Test public void testCheckExpiredSlicedMessageState() throws IOException { doReturn(1).when(mockInputStream).read(any(byte[].class)); final int expiryDuration = 200; try (MessageSlicer slicer = MessageSlicer.builder().messageSliceSize(1) .logContext("testCheckExpiredSlicedMessageState") .fileBackedStreamFactory(mockFiledBackedStreamFactory) .expireStateAfterInactivity(expiryDuration, TimeUnit.MILLISECONDS).build()) { slice(slicer, IDENTIFIER, new BytesMessage(new byte[]{1, 2}), testProbe.ref(), testProbe.ref(), mockOnFailureCallback); Uninterruptibles.sleepUninterruptibly(expiryDuration + 50, TimeUnit.MILLISECONDS); slicer.checkExpiredSlicedMessageState(); assertFailureCallback(RuntimeException.class); verify(mockFiledBackedStream).cleanup(); } }
public void checkExpiredSlicedMessageState() { if (stateCache.size() > 0) { stateCache.cleanUp(); } }
MessageSlicer implements AutoCloseable { public void checkExpiredSlicedMessageState() { if (stateCache.size() > 0) { stateCache.cleanUp(); } } }
MessageSlicer implements AutoCloseable { public void checkExpiredSlicedMessageState() { if (stateCache.size() > 0) { stateCache.cleanUp(); } } MessageSlicer(final Builder builder); }
MessageSlicer implements AutoCloseable { public void checkExpiredSlicedMessageState() { if (stateCache.size() > 0) { stateCache.cleanUp(); } } MessageSlicer(final Builder builder); static Builder builder(); static boolean isHandledMessage(final Object message); boolean slice(final SliceOptions options); boolean handleMessage(final Object message); void checkExpiredSlicedMessageState(); @Override void close(); void cancelSlicing(final @NonNull Predicate<Identifier> filter); }
MessageSlicer implements AutoCloseable { public void checkExpiredSlicedMessageState() { if (stateCache.size() > 0) { stateCache.cleanUp(); } } MessageSlicer(final Builder builder); static Builder builder(); static boolean isHandledMessage(final Object message); boolean slice(final SliceOptions options); boolean handleMessage(final Object message); void checkExpiredSlicedMessageState(); @Override void close(); void cancelSlicing(final @NonNull Predicate<Identifier> filter); static final int DEFAULT_MAX_SLICING_TRIES; }