QueueRemovalMessage extends PooledDistributionMessage { boolean removeQueueEvent(String regionName, HARegionQueue hrq, EventID id) { boolean interrupted = Thread.interrupted(); try { if (logger.isTraceEnabled()) { logger.trace("QueueRemovalMessage: removing dispatched events on queue {} for {}", regionName, id); } hrq.removeDispatchedEvents(id); } catch (RegionDestroyedException ignore) { logger.info( "Queue found destroyed while processing the last dispatched sequence ID for a HARegionQueue's DACE. The event ID is {} for HARegion with name={}", new Object[] {id, regionName}); } catch (CancelException ignore) { return false; } catch (CacheException e) { logger.error(String.format( "QueueRemovalMessage::process:Exception in processing the last dispatched sequence ID for a HARegionQueue's DACE. The problem is with event ID, %s for HARegion with name=%s", regionName, id), e); } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); return false; } catch (RejectedExecutionException ignore) { interrupted = true; } finally { if (interrupted) { Thread.currentThread().interrupt(); } } return true; } QueueRemovalMessage(); @Override void toData(DataOutput out,
      SerializationContext context); @Override int getDSFID(); @Override void fromData(DataInput in,
      DeserializationContext context); @Override String toString();  }
@Test public void removeQueueEventRemovesEvents() throws Exception { assertThat(queueRemovalMessage.removeQueueEvent(regionName2, regionQueue2, eventID2)).isTrue(); verify(regionQueue2).removeDispatchedEvents(eventID2); }
@Test public void removeQueueEventReturnsTrueIfRemovalThrowsCacheException() throws Exception { doThrow(new EntryNotFoundException("")).when(regionQueue2).removeDispatchedEvents(eventID2); assertThat(queueRemovalMessage.removeQueueEvent(regionName2, regionQueue2, eventID2)).isTrue(); }
@Test public void removeQueueEventReturnsTrueIfRemovalThrowsRegionDestroyedException() throws Exception { doThrow(new RegionDestroyedException("", "")).when(regionQueue2) .removeDispatchedEvents(eventID2); assertThat(queueRemovalMessage.removeQueueEvent(regionName2, regionQueue2, eventID2)).isTrue(); }
@Test public void removeQueueEventReturnsFalseIfRemovalThrowsCancelException() throws Exception { doThrow(new CacheClosedException()).when(regionQueue2).removeDispatchedEvents(eventID2); assertThat(queueRemovalMessage.removeQueueEvent(regionName2, regionQueue2, eventID2)).isFalse(); }
@Test public void removeQueueEventReturnsFalseIfRemovalThrowsInterruptedException() throws Exception { doThrow(new InterruptedException()).when(regionQueue2).removeDispatchedEvents(eventID2); assertThat(queueRemovalMessage.removeQueueEvent(regionName2, regionQueue2, eventID2)).isFalse(); }
@Test public void removeQueueEventReturnsTrueIfRemovalThrowsRejectedExecutionException() throws Exception { doThrow(new RejectedExecutionException()).when(regionQueue2).removeDispatchedEvents(eventID2); assertThat(queueRemovalMessage.removeQueueEvent(regionName2, regionQueue2, eventID2)).isTrue(); }