/** * @param node * @see org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor#remove(org.apache.activemq.broker.region.MessageReference) */ @Override public synchronized void remove(MessageReference node) { if (memoryList.remove(node) != null) { node.decrementReferenceCount(); } if (!isDiskListEmpty()) { try { getDiskList().remove(node.getMessageId().getPlistLocator()); } catch (IOException e) { throw new RuntimeException(e); } } }
@Test public void testRemoveSecond() throws Exception { Object first = plist.addLast("First", new ByteSequence("A".getBytes())); Object second = plist.addLast("Second", new ByteSequence("B".getBytes())); assertTrue(plist.remove(second)); assertTrue(plist.remove(first)); assertFalse(plist.remove(first)); }
@Test public void testRemoveSecondPosition() throws Exception { Object first = plist.addLast("First", new ByteSequence("A".getBytes())); Object second = plist.addLast("Second", new ByteSequence("B".getBytes())); assertTrue(plist.remove(second)); assertTrue(plist.remove(first)); assertFalse(plist.remove(first)); }
Object position = entries.remove(key); if( position!=null ) { plist.remove(position);
protected void doTestRemove(final int COUNT) throws IOException { Map<String, ByteSequence> map = new LinkedHashMap<String, ByteSequence>(); for (int i = 0; i < COUNT; i++) { String test = new String("test" + i); ByteSequence bs = new ByteSequence(test.getBytes()); map.put(test, bs); plist.addLast(test, bs); } assertEquals(plist.size(), COUNT); PListEntry entry = getFirst(plist); while (entry != null) { plist.remove(entry.getLocator()); entry = getFirst(plist); } assertEquals(0,plist.size()); }
/** * @param node * @see org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor#remove(org.apache.activemq.broker.region.MessageReference) */ @Override public synchronized void remove(MessageReference node) { if (memoryList.remove(node) != null) { node.decrementReferenceCount(); } if (!isDiskListEmpty()) { try { getDiskList().remove(node.getMessageId().getPlistLocator()); } catch (IOException e) { throw new RuntimeException(e); } } }
/** * @param node * @see org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor#remove(org.apache.activemq.broker.region.MessageReference) */ @Override public synchronized void remove(MessageReference node) { if (memoryList.remove(node) != null) { node.decrementReferenceCount(); } if (!isDiskListEmpty()) { try { getDiskList().remove(node.getMessageId().getPlistLocator()); } catch (IOException e) { throw new RuntimeException(e); } } }
/** * @param node * @see org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor#remove(org.apache.activemq.broker.region.MessageReference) */ @Override public synchronized void remove(MessageReference node) { if (memoryList.remove(node) != null) { node.decrementReferenceCount(); } if (!isDiskListEmpty()) { try { getDiskList().remove(node.getMessageId().getPlistLocator()); } catch (IOException e) { throw new RuntimeException(e); } } }