/** * @return the tempDataStore */ public synchronized PListStore getTempDataStore() { if (tempDataStore == null && !hasStartException()) { if (!isPersistent()) { return null; } try { PersistenceAdapter pa = getPersistenceAdapter(); if( pa!=null && pa instanceof PListStore) { return (PListStore) pa; } } catch (IOException e) { throw new RuntimeException(e); } try { String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl"; this.tempDataStore = (PListStore) getClass().getClassLoader().loadClass(clazz).newInstance(); this.tempDataStore.setDirectory(getTmpDataDirectory()); configureService(tempDataStore); } catch (ClassNotFoundException e) { throw new RuntimeException("Kahadb class PListStoreImpl not found. Add activemq-kahadb jar or set persistent to false on BrokerService.", e); } catch (Exception e) { throw new RuntimeException(e); } } return tempDataStore; }
/** * @param tempDataStore * the tempDataStore to set */ public void setTempDataStore(PListStore tempDataStore) { this.tempDataStore = tempDataStore; if (tempDataStore != null) { if (tmpDataDirectory == null) { tmpDataDirectory = tempDataStore.getDirectory(); } else if (tempDataStore.getDirectory() == null) { tempDataStore.setDirectory(tmpDataDirectory); } } configureService(tempDataStore); }
protected void startStore(File directory) throws Exception { store = createPListStore(); store.setDirectory(directory); store.start(); plist = store.getPList("main"); }
IOHelper.deleteChildren(directory); store = createConcurrentAddRemovePListStore(); store.setDirectory(directory); store.start();
IOHelper.deleteChildren(directory); store = createConcurrentAddIterateRemovePListStore(enablePageCache); store.setDirectory(directory); store.start();
IOHelper.deleteChildren(directory); store = createConcurrentAddIteratePListStore(); store.setDirectory(directory); store.start();
@Test public void testConcurrentAddLast() throws Exception { File directory = store.getDirectory(); store.stop(); IOHelper.mkdirs(directory); IOHelper.deleteChildren(directory); store = createPListStore(); store.setDirectory(directory); store.start(); final int numThreads = 20; final int iterations = 1000; executor = Executors.newFixedThreadPool(100); for (int i=0; i<numThreads; i++) { new Job(i, PListTestSupport.TaskType.ADD, iterations).run(); } for (int i=0; i<numThreads; i++) { executor.execute(new Job(i, PListTestSupport.TaskType.ITERATE, iterations)); } for (int i=0; i<100; i++) { executor.execute(new Job(i+20, PListTestSupport.TaskType.ADD, 100)); } executor.shutdown(); boolean finishedInTime = executor.awaitTermination(60*5, TimeUnit.SECONDS); assertTrue("finished ok", finishedInTime); }
IOHelper.deleteChildren(directory); store = createConcurrentAddRemoveWithPreloadPListStore(); store.setDirectory(directory); store.start();
@Test public void testOverFlow() throws Exception { File directory = store.getDirectory(); store.stop(); IOHelper.mkdirs(directory); IOHelper.deleteChildren(directory); store = createPListStore(); store.setDirectory(directory); store.start(); for (int i=0;i<2000; i++) { new Job(i, PListTestSupport.TaskType.ADD, 5).run(); } // LOG.info("After Load index file: " + store.pageFile.getFile().length()); // LOG.info("After remove index file: " + store.pageFile.getFile().length()); }
/** * @return the tempDataStore */ public synchronized PListStore getTempDataStore() { if (tempDataStore == null) { if (!isPersistent()) { return null; } try { PersistenceAdapter pa = getPersistenceAdapter(); if( pa!=null && pa instanceof PListStore) { return (PListStore) pa; } } catch (IOException e) { throw new RuntimeException(e); } try { String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl"; this.tempDataStore = (PListStore) getClass().getClassLoader().loadClass(clazz).newInstance(); this.tempDataStore.setDirectory(getTmpDataDirectory()); configureService(tempDataStore); } catch (ClassNotFoundException e) { throw new RuntimeException("Kahadb class PListStoreImpl not found. Add activemq-kahadb jar or set persistent to false on BrokerService.", e); } catch (Exception e) { throw new RuntimeException(e); } } return tempDataStore; }
/** * @return the tempDataStore */ public synchronized PListStore getTempDataStore() { if (tempDataStore == null) { if (!isPersistent()) { return null; } try { PersistenceAdapter pa = getPersistenceAdapter(); if( pa!=null && pa instanceof PListStore) { return (PListStore) pa; } } catch (IOException e) { throw new RuntimeException(e); } try { String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl"; this.tempDataStore = (PListStore) getClass().getClassLoader().loadClass(clazz).newInstance(); this.tempDataStore.setDirectory(getTmpDataDirectory()); configureService(tempDataStore); } catch (ClassNotFoundException e) { throw new RuntimeException("Kahadb class PListStoreImpl not found. Add activemq-kahadb jar or set persistent to false on BrokerService.", e); } catch (Exception e) { throw new RuntimeException(e); } } return tempDataStore; }
/** * @return the tempDataStore */ public synchronized PListStore getTempDataStore() { if (tempDataStore == null) { if (!isPersistent()) { return null; } try { PersistenceAdapter pa = getPersistenceAdapter(); if( pa!=null && pa instanceof PListStore) { return (PListStore) pa; } } catch (IOException e) { throw new RuntimeException(e); } try { String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl"; this.tempDataStore = (PListStore) getClass().getClassLoader().loadClass(clazz).newInstance(); this.tempDataStore.setDirectory(getTmpDataDirectory()); configureService(tempDataStore); } catch (ClassNotFoundException e) { throw new RuntimeException("Kahadb class PListStoreImpl not found. Add activemq-kahadb jar or set persistent to false on BrokerService.", e); } catch (Exception e) { throw new RuntimeException(e); } } return tempDataStore; }
/** * @param tempDataStore * the tempDataStore to set */ public void setTempDataStore(PListStore tempDataStore) { this.tempDataStore = tempDataStore; if (tempDataStore != null) { if (tmpDataDirectory == null) { tmpDataDirectory = tempDataStore.getDirectory(); } else if (tempDataStore.getDirectory() == null) { tempDataStore.setDirectory(tmpDataDirectory); } } configureService(tempDataStore); }
/** * @param tempDataStore * the tempDataStore to set */ public void setTempDataStore(PListStore tempDataStore) { this.tempDataStore = tempDataStore; if (tempDataStore != null) { if (tmpDataDirectory == null) { tmpDataDirectory = tempDataStore.getDirectory(); } else if (tempDataStore.getDirectory() == null) { tempDataStore.setDirectory(tmpDataDirectory); } } configureService(tempDataStore); }
/** * @param tempDataStore * the tempDataStore to set */ public void setTempDataStore(PListStore tempDataStore) { this.tempDataStore = tempDataStore; if (tempDataStore != null) { if (tmpDataDirectory == null) { tmpDataDirectory = tempDataStore.getDirectory(); } else if (tempDataStore.getDirectory() == null) { tempDataStore.setDirectory(tmpDataDirectory); } } configureService(tempDataStore); }
/** * Initialize. * * @throws Exception * the exception */ public void initialize() throws Exception { synchronized (SchedulerManager.class) { if (broker == null) { broker = new BrokerService(); Configuration.load("/dirigible-messaging.properties"); if (Boolean.parseBoolean(Configuration.get("DIRIGIBLE_MESSAGING_USE_DEFAULT_DATABASE", "true"))) { PersistenceAdapter persistenceAdapter = new JDBCPersistenceAdapter(dataSource, new OpenWireFormat()); broker.setPersistenceAdapter(persistenceAdapter); } broker.setPersistent(true); broker.setUseJmx(false); // broker.setUseShutdownHook(false); PListStore pListStore = new PListStoreImpl(); pListStore.setDirectory(new File(LOCATION_TEMP_STORE)); broker.setTempDataStore(pListStore); broker.addConnector(CONNECTOR_URL); broker.start(); } } }