本文整理匯總了Java中org.apache.activemq.broker.BrokerService.setEnableStatistics方法的典型用法代碼示例。如果您正苦於以下問題:Java BrokerService.setEnableStatistics方法的具體用法?Java BrokerService.setEnableStatistics怎麽用?Java BrokerService.setEnableStatistics使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.activemq.broker.BrokerService
的用法示例。
在下文中一共展示了BrokerService.setEnableStatistics方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的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);
}
示例2: createBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
protected BrokerService createBroker() throws Exception {
BrokerService brokerService = new BrokerService();
brokerService.setEnableStatistics(false);
brokerService.addConnector("tcp://0.0.0.0:0");
brokerService.setDeleteAllMessagesOnStartup(true);
PolicyEntry policy = new PolicyEntry();
policy.setPrioritizedMessages(true);
policy.setMaxPageSize(500);
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(policy);
brokerService.setDestinationPolicy(policyMap);
setDefaultPersistenceAdapter(brokerService);
return brokerService;
}
示例3: configureBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
@Override
protected void configureBroker(BrokerService answer, String uri) throws Exception {
//AMQPersistenceAdapterFactory persistenceFactory = new AMQPersistenceAdapterFactory();
//persistenceFactory.setMaxFileLength(1024*16);
//persistenceFactory.setPersistentIndex(true);
//persistenceFactory.setCleanupInterval(10000);
//answer.setPersistenceFactory(persistenceFactory);
answer.setDeleteAllMessagesOnStartup(true);
answer.addConnector(uri);
answer.setUseShutdownHook(false);
answer.setEnableStatistics(false);
}
示例4: createBroker
import org.apache.activemq.broker.BrokerService; //導入方法依賴的package包/類
protected BrokerService createBroker() throws Exception {
BrokerService brokerService = new BrokerService();
brokerService.setEnableStatistics(false);
brokerService.addConnector("tcp://0.0.0.0:0");
brokerService.setDeleteAllMessagesOnStartup(true);
PolicyEntry policy = new PolicyEntry();
policy.setPrioritizedMessages(true);
policy.setMaxPageSize(500);
StorePendingDurableSubscriberMessageStoragePolicy durableSubPending = new StorePendingDurableSubscriberMessageStoragePolicy();
durableSubPending.setImmediatePriorityDispatch(true);
durableSubPending.setUseCache(true);
policy.setPendingDurableSubscriberPolicy(durableSubPending);
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(policy);
brokerService.setDestinationPolicy(policyMap);
// if (false) {
// // external mysql works a lot faster
// //
// JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
// BasicDataSource ds = new BasicDataSource();
// com.mysql.jdbc.Driver d = new com.mysql.jdbc.Driver();
// ds.setDriverClassName("com.mysql.jdbc.Driver");
// ds.setUrl("jdbc:mysql://localhost/activemq?relaxAutoCommit=true");
// ds.setMaxActive(200);
// ds.setUsername("root");
// ds.setPassword("");
// ds.setPoolPreparedStatements(true);
// jdbc.setDataSource(ds);
// brokerService.setPersistenceAdapter(jdbc);
/* add mysql bits to the pom in the testing dependencies
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
<scope>test</scope>
</dependency>
*/
// } else {
setPersistenceAdapter(brokerService, persistenceAdapterChoice);
// }
return brokerService;
}