/** * This is a common check we do before scheduling depaging.. or while depaging. * Before scheduling a depage runnable we verify if it fits / needs depaging. * We also check for while needsDepage While depaging. * This is just to avoid a copy & paste dependency * * @return */ private boolean needsDepage() { return queueMemorySize.get() < pageSubscription.getPagingStore().getMaxSize(); }
/** * @param queue * @throws InterruptedException */ private void forcePage(Queue queue) throws InterruptedException { for (long timeout = System.currentTimeMillis() + 5000; timeout > System.currentTimeMillis() && !queue.getPageSubscription().getPagingStore().isPaging(); ) { Thread.sleep(10); } assertTrue(queue.getPageSubscription().getPagingStore().isPaging()); }
/** * @param queue * @throws InterruptedException */ protected void waitForNotPaging(Queue queue) throws InterruptedException { waitForNotPaging(queue.getPageSubscription().getPagingStore()); }
long maxSize = pageSubscription.getPagingStore().getPageSizeBytes();
assertEquals(0L, queueView.getPageSubscription().getPagingStore().getAddressSize());
Assert.assertEquals(0, purgeQueue.getPageSubscription().getPagingStore().getAddressSize()); producer.send(session.createTextMessage("hello" + i)); if (i == 10) { purgeQueue.getPageSubscription().getPagingStore().startPaging(); Wait.assertEquals(0, purgeQueue.getPageSubscription().getPagingStore()::getAddressSize); purgeQueue.getPageSubscription().getPagingStore().startPaging(); purgeQueue.getPageSubscription().getPagingStore().startPaging(); Assert.assertTrue(purgeQueue.getPageSubscription().isPaging()); producer.send(session.createTextMessage("hello" + i)); Wait.assertEquals(0, purgeQueue.getPageSubscription().getPagingStore()::getAddressSize); Wait.assertFalse(purgeQueue.getPageSubscription()::isPaging);
queue.getPageSubscription().getPagingStore().startPaging(); queue.getPageSubscription().getPagingStore().forceAnotherPage(); queue.getPageSubscription().getPagingStore().disableCleanup(); queue.getPageSubscription().getPagingStore().getCursorProvider().cleanup(); queue.getPageSubscription().getPagingStore().getCursorProvider().cleanup(); queue.getPageSubscription().getPagingStore().enableCleanup();
@Override @Before public void setUp() throws Exception { super.setUp(); server = internalCreateServer(); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); Queue queue = server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); queue.getPageSubscription().getPagingStore().startPaging(); for (int i = 0; i < 10; i++) { queue.getPageSubscription().getPagingStore().forceAnotherPage(); } final ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, true, true, false, 0); ClientProducer prod = session.createProducer(ADDRESS); for (int i = 0; i < 500; i++) { ClientMessage msg = session.createMessage(true); msg.putIntProperty("key", i); prod.send(msg); if (i > 0 && i % 10 == 0) { session.commit(); } } session.close(); locator.close(); server.stop(); server = internalCreateServer(); }
assertEquals(0L, queueView.getPageSubscription().getPagingStore().getAddressSize()); assertEquals(0, queueView.getMessageCount()); assertEquals(0L, queueView.getPageSubscription().getPagingStore().getAddressSize()); assertEquals(0L, queueView.getPageSubscription().getPagingStore().getAddressSize());
queue.getPageSubscription().getPagingStore().forceAnotherPage();
Queue queue = server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); queue.getPageSubscription().getPagingStore().startPaging(); queue.getPageSubscription().getPagingStore().forceAnotherPage(); queue.getPageSubscription().getPagingStore().disableCleanup();
@Test public void testConcurrentProduceCreateAndDelete() throws Throwable { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(true, true); ClientProducer producer = session.createProducer(ADDRESS); // just to make it page forever Queue serverQueue = server.createQueue(ADDRESS, RoutingType.ANYCAST, SimpleString.toSimpleString("everPage"), null, true, false); serverQueue.getPageSubscription().getPagingStore().startPaging(); Consumer[] consumers = new Consumer[10]; for (int i = 0; i < consumers.length; i++) { consumers[i] = new Consumer(); consumers[i].start(); } for (int i = 0; i < 50000 && running; i++) { producer.send(session.createMessage(true)); //Thread.sleep(10); } session.close(); running = false; for (Consumer consumer : consumers) { consumer.join(); if (consumer.ex != null) { throw consumer.ex; } } }
while (queue.getPageSubscription().getPagingStore().isPaging() && timeout > System.currentTimeMillis()) { Thread.sleep(1); assertFalse(queue.getPageSubscription().getPagingStore().isPaging());
@Before @Override public void setUp() throws Exception { super.setUp(); server = createServer(true, isNetty); AddressSettings addressSettings = new AddressSettings(); addressSettings.setSlowConsumerCheckPeriod(1); addressSettings.setSlowConsumerThreshold(threshold); addressSettings.setSlowConsumerPolicy(SlowConsumerPolicy.KILL); if (isPaging) { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setMaxSizeBytes(10 * 1024); addressSettings.setPageSizeBytes(1024); } else { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK); addressSettings.setMaxSizeBytes(-1); addressSettings.setPageSizeBytes(1024); } server.start(); server.getAddressSettingsRepository().addMatch(QUEUE.toString(), addressSettings); server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false).getPageSubscription().getPagingStore().startPaging(); locator = createFactory(isNetty); }
queue.getPageSubscription().getPagingStore().startPaging(); assertNotNull(msg); queue.getPageSubscription().getPagingStore().forceAnotherPage();
queue.getPageSubscription().getPagingStore().startPaging();
Assert.assertEquals(serverQueue.getPageSubscription().getPagingStore().getAddressSize(), addressControl.getAddressSize());
PagingStore store = server.getPagingManager().getPageStore(ADDRESS); Queue queue = server.locateQueue(PagingTest.ADDRESS.concat("=1")); queue.getPageSubscription().getPagingStore().startPaging(); queue.getPageSubscription().getPagingStore().forceAnotherPage();
PagingStore store = queue.getPageSubscription().getPagingStore();
queue.getPageSubscription().getPagingStore().startPaging();