Tabnine Logo
PagingManagerImpl
Code IndexAdd Tabnine to your IDE (free)

How to use
PagingManagerImpl
in
org.apache.activemq.artemis.core.paging.impl

Best Java code snippets using org.apache.activemq.artemis.core.paging.impl.PagingManagerImpl (Showing top 12 results out of 315)

origin: apache/activemq-artemis

 @Override
 public void under(FileStore store, double usage) {
   if (diskFull || !blockedStored.isEmpty() || !memoryCallback.isEmpty()) {
    ActiveMQServerLogger.LOGGER.diskCapacityRestored();
    diskFull = false;
    checkMemoryRelease();
   }
 }
}
origin: apache/activemq-artemis

  @Override
  public void run() {
   debug();
  }
};
origin: apache/activemq-artemis

@Override
public void checkMemory(final Runnable runWhenAvailable) {
 if (isGlobalFull()) {
   memoryCallback.add(AtomicRunnable.checkAtomic(runWhenAvailable));
   return;
 }
 runWhenAvailable.run();
}
origin: apache/activemq-artemis

@Override
public PagingManager createPagingManager() throws Exception {
 return new PagingManagerImpl(getPagingStoreFactory(), addressSettingsRepository, configuration.getGlobalMaxSize(), configuration.getManagementAddress());
}
origin: apache/activemq-artemis

@Test
public void testMoveOverPaging() throws Exception {
 AssertionLoggerHandler.startCapture();
 ExecutorService threadPool = Executors.newCachedThreadPool();
 try {
   manager.setMaxFolders(3);
   for (int i = 1; i <= 10; i++) {
    HierarchicalRepository<AddressSettings> addressSettings = new HierarchicalObjectRepository<>();
    AddressSettings settings = new AddressSettings();
    settings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
    addressSettings.setDefault(settings);
    final StorageManager storageManager = new NullStorageManager();
    PagingStoreFactoryNIO storeFactory = new PagingStoreFactoryNIO(storageManager, dataLocation, 100, null, new OrderedExecutorFactory(threadPool), true, null);
    PagingManagerImpl managerImpl = new PagingManagerImpl(storeFactory, addressSettings, -1, ActiveMQDefaultConfiguration.getDefaultManagementAddress());
    managerImpl.start();
    PagingStore store = managerImpl.getPageStore(new SimpleString("simple-test"));
    store.startPaging();
    store.stop();
    managerImpl.stop();
    manager.doMove();
    Assert.assertEquals(Math.min(i, manager.getMaxFolders()), manager.getNumberOfFolders());
   }
   Assert.assertFalse("The loggers are complaining about address.txt", AssertionLoggerHandler.findText("address.txt"));
 } finally {
   AssertionLoggerHandler.stopCapture();
   threadPool.shutdown();
 }
}
origin: apache/activemq-artemis

@Test
public void testPagingManager() throws Exception {
 HierarchicalRepository<AddressSettings> addressSettings = new HierarchicalObjectRepository<>();
 addressSettings.setDefault(new AddressSettings().setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE));
 final StorageManager storageManager = new NullStorageManager();
 PagingStoreFactoryNIO storeFactory = new PagingStoreFactoryNIO(storageManager, getPageDirFile(), 100, null, getOrderedExecutor(), true, null);
 PagingManagerImpl managerImpl = new PagingManagerImpl(storeFactory, addressSettings);
 managerImpl.start();
 PagingStore store = managerImpl.getPageStore(new SimpleString("simple-test"));
 ICoreMessage msg = createMessage(1L, new SimpleString("simple-test"), createRandomBuffer(10));
 final RoutingContextImpl ctx = new RoutingContextImpl(null);
 Assert.assertFalse(store.page(msg, ctx.getTransaction(), ctx.getContextListing(store.getStoreName()), lock));
 store.startPaging();
 Assert.assertTrue(store.page(msg, ctx.getTransaction(), ctx.getContextListing(store.getStoreName()), lock));
 Page page = store.depage();
 page.open();
 List<PagedMessage> msgs = page.read(new NullStorageManager());
 page.close();
 Assert.assertEquals(1, msgs.size());
 ActiveMQTestBase.assertEqualsByteArrays(msg.getBodyBuffer().writerIndex(), msg.getBodyBuffer().toByteBuffer().array(), (msgs.get(0).getMessage()).toCore().getBodyBuffer().toByteBuffer().array());
 Assert.assertTrue(store.isPaging());
 Assert.assertNull(store.depage());
 final RoutingContextImpl ctx2 = new RoutingContextImpl(null);
 Assert.assertFalse(store.page(msg, ctx2.getTransaction(), ctx2.getContextListing(store.getStoreName()), lock));
}
origin: org.apache.activemq/artemis-cli

private static void printPages(File pageDirectory, DescribeJournal describeJournal, PrintStream out, boolean safe) {
 try {
   ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory());
   final ExecutorService executor = Executors.newFixedThreadPool(10, ActiveMQThreadFactory.defaultThreadFactory());
   ExecutorFactory execfactory = new ExecutorFactory() {
    @Override
    public ArtemisExecutor getExecutor() {
      return ArtemisExecutor.delegate(executor);
    }
   };
   final StorageManager sm = new NullStorageManager();
   PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(sm, pageDirectory, 1000L, scheduled, execfactory, false, null);
   HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>();
   addressSettingsRepository.setDefault(new AddressSettings());
   PagingManager manager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository);
   printPages(describeJournal, sm, manager, out, safe);
 } catch (Exception e) {
   e.printStackTrace();
 }
}
origin: apache/activemq-artemis

private static void printPages(File pageDirectory, DescribeJournal describeJournal, PrintStream out, boolean safe) {
 try {
   ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory());
   final ExecutorService executor = Executors.newFixedThreadPool(10, ActiveMQThreadFactory.defaultThreadFactory());
   ExecutorFactory execfactory = new ExecutorFactory() {
    @Override
    public ArtemisExecutor getExecutor() {
      return ArtemisExecutor.delegate(executor);
    }
   };
   final StorageManager sm = new NullStorageManager();
   PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(sm, pageDirectory, 1000L, scheduled, execfactory, false, null);
   HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>();
   addressSettingsRepository.setDefault(new AddressSettings());
   PagingManager manager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository);
   printPages(describeJournal, sm, manager, out, safe);
 } catch (Exception e) {
   e.printStackTrace();
 }
}
origin: apache/activemq-artemis

@Override
public PagingManagerImpl addSize(int size) {
 if (size > 0) {
   numberOfMessages.incrementAndGet();
 } else {
   numberOfMessages.decrementAndGet();
 }
 long newSize = globalSizeBytes.addAndGet(size);
 if (newSize < 0) {
   ActiveMQServerLogger.LOGGER.negativeGlobalAddressSize(newSize);
 }
 if (size < 0) {
   checkMemoryRelease();
 }
 return this;
}
origin: apache/activemq-artemis

protected void initializeJournal(Configuration configuration) throws Exception {
 this.config = configuration;
 executor = Executors.newFixedThreadPool(5, ActiveMQThreadFactory.defaultThreadFactory());
 executorFactory = new OrderedExecutorFactory(executor);
 scheduledExecutorService = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(), new ThreadFactory() {
   @Override
   public Thread newThread(Runnable r) {
    return new Thread(r);
   }
 });
 HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>(config.getWildcardConfiguration());
 addressSettingsRepository.setDefault(new AddressSettings());
 if (configuration.isJDBC()) {
   storageManager = new JDBCJournalStorageManager(config, null, scheduledExecutorService, executorFactory, executorFactory, null);
   PagingStoreFactory pageStoreFactory = new PagingStoreFactoryDatabase((DatabaseStorageConfiguration) configuration.getStoreConfiguration(),
                                     storageManager, 1000L,
                                     scheduledExecutorService, executorFactory,
                                     false, null);
   pagingmanager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository, configuration.getManagementAddress());
 } else {
   storageManager = new JournalStorageManager(config, EmptyCriticalAnalyzer.getInstance(), executorFactory, executorFactory);
   PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(storageManager, config.getPagingLocation(), 1000L, scheduledExecutorService, executorFactory, true, null);
   pagingmanager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository, configuration.getManagementAddress());
 }
}
origin: org.apache.activemq/artemis-cli

protected void initializeJournal(Configuration configuration) throws Exception {
 this.config = configuration;
 executor = Executors.newFixedThreadPool(5, ActiveMQThreadFactory.defaultThreadFactory());
 executorFactory = new OrderedExecutorFactory(executor);
 scheduledExecutorService = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(), new ThreadFactory() {
   @Override
   public Thread newThread(Runnable r) {
    return new Thread(r);
   }
 });
 HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>(config.getWildcardConfiguration());
 addressSettingsRepository.setDefault(new AddressSettings());
 if (configuration.isJDBC()) {
   storageManager = new JDBCJournalStorageManager(config, null, scheduledExecutorService, executorFactory, executorFactory, null);
   PagingStoreFactory pageStoreFactory = new PagingStoreFactoryDatabase((DatabaseStorageConfiguration) configuration.getStoreConfiguration(),
                                     storageManager, 1000L,
                                     scheduledExecutorService, executorFactory,
                                     false, null);
   pagingmanager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository, configuration.getManagementAddress());
 } else {
   storageManager = new JournalStorageManager(config, EmptyCriticalAnalyzer.getInstance(), executorFactory, executorFactory);
   PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(storageManager, config.getPagingLocation(), 1000L, scheduledExecutorService, executorFactory, true, null);
   pagingmanager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository, configuration.getManagementAddress());
 }
}
origin: apache/activemq-artemis

protected PagingManager createPageManager(final StorageManager storageManager,
                     final Configuration configuration,
                     final ExecutorFactory executorFactory,
                     final HierarchicalRepository<AddressSettings> addressSettingsRepository) throws Exception {
 PagingManager paging = new PagingManagerImpl(new PagingStoreFactoryNIO(storageManager, configuration.getPagingLocation(), 1000, null, executorFactory, false, null), addressSettingsRepository, configuration.getManagementAddress());
 paging.start();
 return paging;
}
org.apache.activemq.artemis.core.paging.implPagingManagerImpl

Most used methods

  • <init>
  • getPageStore
    This method creates a new store if not exist.
  • start
  • checkMemoryRelease
  • debug
  • isGlobalFull
  • lock
  • memoryReleased
  • newStore
  • reapplySettings
  • reloadStores
  • stop
  • reloadStores,
  • stop,
  • unlock

Popular in Java

  • Start an intent from android
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setRequestProperty (URLConnection)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now