• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java KahaDBPersistenceAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter的典型用法代码示例。如果您正苦于以下问题:Java KahaDBPersistenceAdapter类的具体用法?Java KahaDBPersistenceAdapter怎么用?Java KahaDBPersistenceAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



KahaDBPersistenceAdapter类属于org.apache.activemq.store.kahadb包,在下文中一共展示了KahaDBPersistenceAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: appendKahaDbStore

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
private static void appendKahaDbStore(final ArtemisJournalMarshaller xmlMarshaller,
        final KahaDBPersistenceAdapter adapter, final String queuePattern, final String topicPattern) throws Exception {

    try {
        adapter.start();

        final KahaDBExporter dbExporter = new KahaDBExporter(adapter,
                new ArtemisXmlMetadataExporter(adapter.getStore(), xmlMarshaller),
                new ArtemisXmlMessageRecoveryListener(adapter.getStore(), xmlMarshaller));

        xmlMarshaller.appendBindingsElement();
        dbExporter.exportMetadata();
        xmlMarshaller.appendEndElement();
        xmlMarshaller.appendMessagesElement();
        dbExporter.exportQueues(queuePattern);
        dbExporter.exportTopics(topicPattern);
        xmlMarshaller.appendEndElement();
    } finally {
        adapter.stop();
    }
}
 
开发者ID:apache,项目名称:activemq-cli-tools,代码行数:22,代码来源:Exporter.java


示例2: configureBroker

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
protected void configureBroker(BrokerService answer) throws Exception {
   File dataFileDir = new File("target/test-amq-data/perfTest/kahadb");

   KahaDBPersistenceAdapter kaha = new KahaDBPersistenceAdapter();
   kaha.setDirectory(dataFileDir);
   //answer.setUseJmx(false);

   // The setEnableJournalDiskSyncs(false) setting is a little dangerous right now, as I have not verified
   // what happens if the index is updated but a journal update is lost.
   // Index is going to be in consistent, but can it be repaired?
   //kaha.setEnableJournalDiskSyncs(false);
   // Using a bigger journal file size makes he take fewer spikes as it is not switching files as often.
   //kaha.setJournalMaxFileLength(1024*100);

   // small batch means more frequent and smaller writes
   //kaha.setIndexWriteBatchSize(100);
   // do the index write in a separate thread
   //kaha.setEnableIndexWriteAsync(true);

   answer.setPersistenceAdapter(kaha);
   answer.setAdvisorySupport(false);
   answer.setEnableStatistics(false);
   answer.addConnector(bindAddress);
   answer.setDeleteAllMessagesOnStartup(true);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:NumberOfDestinationsTest.java


示例3: configureBroker

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
protected void configureBroker(BrokerService broker) throws Exception {
   super.configureBroker(broker);

   MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
   List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
   FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
   defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
   adapters.add(defaultEntry);

   FilteredKahaDBPersistenceAdapter special = new FilteredKahaDBPersistenceAdapter();
   special.setDestination(new ActiveMQQueue("special"));
   special.setPersistenceAdapter(new KahaDBPersistenceAdapter());
   adapters.add(special);

   mKahaDB.setFilteredPersistenceAdapters(adapters);
   broker.setPersistenceAdapter(mKahaDB);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:mKahaDBXARecoveryBrokerTest.java


示例4: setUp

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
   setMaxTestTime(10 * 60 * 1000); // 10 mins
   setAutoFail(true);
   super.setUp();
   broker = new BrokerService();

   File testDataDir = new File("target/activemq-data/QueuePurgeTest");
   broker.setDataDirectoryFile(testDataDir);
   broker.setUseJmx(true);
   broker.setDeleteAllMessagesOnStartup(true);
   broker.getSystemUsage().getMemoryUsage().setLimit(1024L * 1024 * 64);
   KahaDBPersistenceAdapter persistenceAdapter = new KahaDBPersistenceAdapter();
   persistenceAdapter.setDirectory(new File(testDataDir, "kahadb"));
   broker.setPersistenceAdapter(persistenceAdapter);
   broker.addConnector("tcp://localhost:0");
   broker.start();
   factory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri().toString());
   connection = factory.createConnection();
   connection.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:QueuePurgeTest.java


示例5: createMaster

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
protected void createMaster() throws Exception {
   master = new BrokerService();
   master.setBrokerName("master");
   master.addConnector(MASTER_URL);
   master.setUseJmx(false);
   master.setPersistent(true);
   master.setDeleteAllMessagesOnStartup(true);

   MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
   List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
   FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
   defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
   defaultEntry.setPerDestination(true);
   adapters.add(defaultEntry);

   mKahaDB.setFilteredPersistenceAdapters(adapters);
   master.setPersistenceAdapter(mKahaDB);

   master.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:mKahaDbQueueMasterSlaveTest.java


示例6: createMaster

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
protected void createMaster() throws Exception {
   master = new BrokerService();
   master.setBrokerName("master");
   master.addConnector(MASTER_URL);
   master.setUseJmx(false);
   master.setPersistent(true);
   master.setDeleteAllMessagesOnStartup(true);
   KahaDBPersistenceAdapter kahaDBPersistenceAdapter = (KahaDBPersistenceAdapter) master.getPersistenceAdapter();
   LeaseDatabaseLocker leaseDatabaseLocker = new LeaseDatabaseLocker();
   leaseDatabaseLocker.setCreateTablesOnStartup(true);
   leaseDatabaseLocker.setDataSource(getExistingDataSource());
   leaseDatabaseLocker.setStatements(new Statements());
   kahaDBPersistenceAdapter.setLocker(leaseDatabaseLocker);
   configureLocker(kahaDBPersistenceAdapter);
   configureBroker(master);
   master.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:kahaDbJdbcLeaseQueueMasterSlaveTest.java


示例7: createBroker

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
private void createBroker(boolean delete) throws Exception {
   broker = BrokerFactory.createBroker("broker:(vm://localhost)");
   broker.setKeepDurableSubsActive(true);
   broker.setPersistent(true);
   broker.setDeleteAllMessagesOnStartup(delete);
   KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter();
   kahadb.setDirectory(new File("activemq-data/" + getName() + "-kahadb"));
   kahadb.setJournalMaxFileLength(500 * 1024);
   broker.setPersistenceAdapter(kahadb);
   broker.setBrokerName(getName());

   // only if we pre-create the destinations
   broker.setDestinations(new ActiveMQDestination[]{topic});

   broker.start();
   broker.waitUntilStarted();

   connection = createConnection();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:DurableSubscriptionActivationTest.java


示例8: startBroker

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
private void startBroker(boolean deleteAllMessages) throws Exception {
   if (broker != null)
      return;

   broker = BrokerFactory.createBroker("broker:(vm://localhost)");
   broker.setBrokerName(getName());
   broker.setDeleteAllMessagesOnStartup(deleteAllMessages);

   if (PERSISTENT_BROKER) {
      broker.setPersistent(true);
      KahaDBPersistenceAdapter persistenceAdapter = new KahaDBPersistenceAdapter();
      persistenceAdapter.setDirectory(new File("activemq-data/" + getName()));
      broker.setPersistenceAdapter(persistenceAdapter);
   } else
      broker.setPersistent(false);

   broker.addConnector("tcp://localhost:61656");

   broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
   broker.getSystemUsage().getTempUsage().setLimit(256 * 1024 * 1024);
   broker.getSystemUsage().getStoreUsage().setLimit(256 * 1024 * 1024);

   broker.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:DurableSubProcessTest.java


示例9: startBroker

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
private void startBroker(boolean deleteMessages) throws Exception {
   broker = BrokerFactory.createBroker("broker:(vm://" + getName() + ")");
   broker.setUseJmx(true);
   broker.getManagementContext().setCreateConnector(false);
   broker.setBrokerName(getName());

   broker.setPersistent(true);
   KahaDBPersistenceAdapter persistenceAdapter = new KahaDBPersistenceAdapter();
   persistenceAdapter.setDirectory(new File("activemq-data/" + getName()));
   broker.setPersistenceAdapter(persistenceAdapter);
   if (deleteMessages) {
      broker.setDeleteAllMessagesOnStartup(true);
   }

   broker.setKeepDurableSubsActive(true);

   broker.start();
   broker.waitUntilStarted();

   connection = createConnection();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:DurableSubscriptionUnsubscribeTest.java


示例10: hasLockOwnership

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
protected boolean hasLockOwnership() throws IOException {
  boolean hasLock = true;

  if(broker.getPersistenceAdapter() instanceof KahaDBPersistenceAdapter) {
    LockableServiceSupport persistenceAdapter = (LockableServiceSupport) broker.getPersistenceAdapter();
    Locker locker = persistenceAdapter.getLocker();

    if(locker != null && locker instanceof ActiveMQLeaseDatabaseLocker) {
      try {
        if(!locker.keepAlive()) {
          hasLock = false;
        }
      }
      catch(IOException ignored) {
      }

      if(!hasLock) {
        throw new IOException("PersistenceAdapter lock no longer valid using: " + locker);
      }
    }
  }

  return hasLock;
}
 
开发者ID:PaulGale,项目名称:amq-db-lease-locker,代码行数:26,代码来源:ActiveMQLeaseDatabaseLockerIOExceptionHandler.java


示例11: getMultiKahaDbAdapter

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
private static MultiKahaDBPersistenceAdapter getMultiKahaDbAdapter(File dir) {
    MultiKahaDBPersistenceAdapter adapter = new MultiKahaDBPersistenceAdapter();
    adapter.setDirectory(dir);

    KahaDBPersistenceAdapter kahaStore = new KahaDBPersistenceAdapter();
    kahaStore.setDirectory(dir);
    FilteredKahaDBPersistenceAdapter filtered = new FilteredKahaDBPersistenceAdapter();
    filtered.setPersistenceAdapter(kahaStore);
    filtered.setPerDestination(true);

    adapter.setFilteredPersistenceAdapters(Lists.newArrayList(filtered));
    return adapter;
}
 
开发者ID:apache,项目名称:activemq-cli-tools,代码行数:14,代码来源:Exporter.java


示例12: KahaDBExporter

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
public KahaDBExporter(final KahaDBPersistenceAdapter adapter,
        final MessageStoreMetadataExporter metadataExporter,
        final MessageRecoveryListener recoveryListener) {
    this.adapter = adapter;
    this.metadataExporter = metadataExporter;
    this.recoveryListener = recoveryListener;
}
 
开发者ID:apache,项目名称:activemq-cli-tools,代码行数:8,代码来源:KahaDBExporter.java


示例13: before

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Before
public void before() throws Exception {
    adapter = new KahaDBPersistenceAdapter();
    adapter.setJournalMaxFileLength(1024 * 1024);
    adapter.setDirectory(storeFolder.getRoot());
    adapter.start();
    store = adapter.getStore();
}
 
开发者ID:apache,项目名称:activemq-cli-tools,代码行数:9,代码来源:OpenWireCoreMessageTypeConverterTest.java


示例14: getPersistenceAdapter

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
public PersistenceAdapter getPersistenceAdapter(File dir) {
    MultiKahaDBPersistenceAdapter adapter = new MultiKahaDBPersistenceAdapter();
    adapter.setJournalMaxFileLength(1024 * 1024);
    adapter.setDirectory(dir);

    KahaDBPersistenceAdapter kahaStore = new KahaDBPersistenceAdapter();
    kahaStore.setDirectory(dir);
    FilteredKahaDBPersistenceAdapter filtered = new FilteredKahaDBPersistenceAdapter();
    filtered.setPersistenceAdapter(kahaStore);
    filtered.setPerDestination(true);

    adapter.setFilteredPersistenceAdapters(Lists.newArrayList(filtered));
    return adapter;
}
 
开发者ID:apache,项目名称:activemq-cli-tools,代码行数:16,代码来源:MultiKahaDbExporterTest.java


示例15: getPersistenceAdapter

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
public PersistenceAdapter getPersistenceAdapter(File dir) {
    KahaDBPersistenceAdapter adapter = new KahaDBPersistenceAdapter();
    adapter.setJournalMaxFileLength(1024 * 1024);
    adapter.setDirectory(dir);
    return adapter;
}
 
开发者ID:apache,项目名称:activemq-cli-tools,代码行数:8,代码来源:KahaDbExporterTest.java


示例16: persistenceAdapterFactory_KahaDB

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
private PersistenceAdapter persistenceAdapterFactory_KahaDB(String path) {
   KahaDBPersistenceAdapter kahaDBPersistenceAdapter = new KahaDBPersistenceAdapter();
   kahaDBPersistenceAdapter.setDirectory(new File(path));
   kahaDBPersistenceAdapter.setIgnoreMissingJournalfiles(true);
   kahaDBPersistenceAdapter.setCheckForCorruptJournalFiles(true);
   kahaDBPersistenceAdapter.setChecksumJournalFiles(true);
   return kahaDBPersistenceAdapter;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:CheckDuplicateMessagesOnDuplexTest.java


示例17: main

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
public static void main(String arg[]) {

      try {
         KahaDBPersistenceAdapter kahaDB = new KahaDBPersistenceAdapter();
         File dataFileDir = new File("target/test-amq-data/perfTest/kahadb");
         IOHelper.deleteChildren(dataFileDir);
         kahaDB.setDirectory(dataFileDir);

         // The setEnableJournalDiskSyncs(false) setting is a little
         // dangerous right now, as I have not verified
         // what happens if the index is updated but a journal update is
         // lost.
         // Index is going to be in consistent, but can it be repaired?
         // kaha.setEnableJournalDiskSyncs(false);
         // Using a bigger journal file size makes he take fewer spikes as it
         // is not switching files as often.
         // kaha.setJournalMaxFileLength(1024*1024*100);

         // small batch means more frequent and smaller writes
         kahaDB.setIndexWriteBatchSize(1000);
         kahaDB.setIndexCacheSize(10000);

         // do the index write in a separate thread
         // kahaDB.setEnableIndexWriteAsync(true);
         BrokerService broker = new BrokerService();
         broker.setUseJmx(false);
         // broker.setPersistenceAdapter(adaptor);
         broker.setPersistenceAdapter(kahaDB);
         // broker.setPersistent(false);
         broker.setDeleteAllMessagesOnStartup(true);
         broker.addConnector("tcp://0.0.0.0:61616");
         broker.start();
         System.err.println("Running");
         Thread.sleep(Long.MAX_VALUE);
      } catch (Throwable e) {
         e.printStackTrace();
      }

   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:40,代码来源:RunBroker.java


示例18: configureBroker

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
protected void configureBroker(BrokerService answer, String uri) throws Exception {

   File dataFileDir = new File("target/test-amq-data/perfTest/kahadb");
   File archiveDir = new File(dataFileDir, "archive");
   KahaDBPersistenceAdapter kaha = new KahaDBPersistenceAdapter();
   kaha.setDirectory(dataFileDir);
   kaha.setDirectoryArchive(archiveDir);
   kaha.setArchiveDataLogs(false);

   // The setEnableJournalDiskSyncs(false) setting is a little dangerous right now, as I have not verified
   // what happens if the index is updated but a journal update is lost.
   // Index is going to be in consistent, but can it be repaired?
   kaha.setEnableJournalDiskSyncs(true);
   // Using a bigger journal file size makes he take fewer spikes as it is not switching files as often.
   //kaha.setJournalMaxFileLength(1024*1024*100);

   // small batch means more frequent and smaller writes
   //kaha.setIndexWriteBatchSize(100);
   // do the index write in a separate thread
   kaha.setEnableIndexWriteAsync(true);
   kaha.setIndexCacheSize(10000);

   answer.setPersistenceAdapter(kaha);
   answer.addConnector(uri);
   answer.setDeleteAllMessagesOnStartup(true);

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:29,代码来源:KahaDBQueueTest.java


示例19: createSlave

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
protected void createSlave() throws Exception {
   // use a separate thread as the slave will block waiting for
   // the exclusive db lock
   Thread t = new Thread() {
      @Override
      public void run() {
         try {
            BrokerService broker = new BrokerService();
            broker.setBrokerName("slave");
            TransportConnector connector = new TransportConnector();
            connector.setUri(new URI(SLAVE_URL));
            broker.addConnector(connector);
            // no need for broker.setMasterConnectorURI(masterConnectorURI)
            // as the db lock provides the slave/master initialisation
            broker.setUseJmx(false);
            broker.setPersistent(true);

            MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
            List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
            FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
            defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
            defaultEntry.setPerDestination(true);
            adapters.add(defaultEntry);

            mKahaDB.setFilteredPersistenceAdapters(adapters);
            broker.setPersistenceAdapter(mKahaDB);
            broker.start();
            slave.set(broker);
            slaveStarted.countDown();
         } catch (IllegalStateException expectedOnShutdown) {
         } catch (Exception e) {
            fail("failed to start slave broker, reason:" + e);
         }
      }
   };
   t.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:39,代码来源:mKahaDbQueueMasterSlaveTest.java


示例20: createSlave

import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; //导入依赖的package包/类
@Override
protected void createSlave() throws Exception {
   // use a separate thread as the slave will block waiting for
   // the exclusive db lock
   Thread t = new Thread() {
      @Override
      public void run() {
         try {
            BrokerService broker = new BrokerService();
            broker.setBrokerName("slave");
            TransportConnector connector = new TransportConnector();
            connector.setUri(new URI(SLAVE_URL));
            broker.addConnector(connector);
            broker.setUseJmx(false);
            broker.setPersistent(true);
            KahaDBPersistenceAdapter kahaDBPersistenceAdapter = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
            LeaseDatabaseLocker leaseDatabaseLocker = new LeaseDatabaseLocker();
            leaseDatabaseLocker.setDataSource(getExistingDataSource());
            leaseDatabaseLocker.setStatements(new Statements());
            kahaDBPersistenceAdapter.setLocker(leaseDatabaseLocker);
            configureLocker(kahaDBPersistenceAdapter);
            configureBroker(broker);
            broker.start();
            slave.set(broker);
            slaveStarted.countDown();
         } catch (IllegalStateException expectedOnShutdown) {
         } catch (Exception e) {
            fail("failed to start slave broker, reason:" + e);
         }
      }
   };
   t.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:34,代码来源:kahaDbJdbcLeaseQueueMasterSlaveTest.java



注:本文中的org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ShadowMatch类代码示例发布时间:2022-05-23
下一篇:
Java ProvisioningJob类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap