/** * Create the directory if it doesn't exist yet */ @Override public void createDirs() throws Exception { boolean ok = journalDir.mkdirs(); if (!ok && !journalDir.exists()) { IOException e = new IOException("Unable to create directory: " + journalDir); onIOError(e, e.getMessage(), null); throw e; } }
@Override public MappedSequentialFileFactory setDatasync(boolean enabled) { super.setDatasync(enabled); return this; }
@Override public void start() { if (timedBuffer != null) { timedBuffer.start(); } if (isSupportsCallbacks()) { writeExecutor = Executors.newSingleThreadExecutor(AccessController.doPrivileged(new PrivilegedAction<ActiveMQThreadFactory>() { @Override public ActiveMQThreadFactory run() { return new ActiveMQThreadFactory("ActiveMQ-Asynchronous-Persistent-Writes" + System.identityHashCode(this), true, AbstractSequentialFileFactory.class.getClassLoader()); } })); } }
@Override public void start() { if (running.compareAndSet(false, true)) { super.start(); this.libaioContext = new LibaioContext(maxIO, true, dataSync); this.running.set(true); pollerThread = new PollerThread(); pollerThread.start(); } }
@Override public void stop() { if (this.running.compareAndSet(true, false)) { buffersControl.stop(); libaioContext.close(); libaioContext = null; if (pollerThread != null) { try { pollerThread.join(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT * 1000); if (pollerThread.isAlive()) { ActiveMQJournalLogger.LOGGER.timeoutOnPollerShutdown(new Exception("trace")); } } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } super.stop(); } }
@Override public void start() { if (timedBuffer != null) { timedBuffer.start(); } if (isSupportsCallbacks()) { writeExecutor = Executors.newSingleThreadExecutor(AccessController.doPrivileged(new PrivilegedAction<ActiveMQThreadFactory>() { @Override public ActiveMQThreadFactory run() { return new ActiveMQThreadFactory("ActiveMQ-Asynchronous-Persistent-Writes" + System.identityHashCode(this), true, AbstractSequentialFileFactory.class.getClassLoader()); } })); } }
@Override public void start() { if (running.compareAndSet(false, true)) { super.start(); this.libaioContext = new LibaioContext(maxIO, true, dataSync); this.running.set(true); pollerThread = new PollerThread(); pollerThread.start(); } }
@Override public void stop() { if (this.running.compareAndSet(true, false)) { buffersControl.stop(); libaioContext.close(); libaioContext = null; if (pollerThread != null) { try { pollerThread.join(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT * 1000); if (pollerThread.isAlive()) { ActiveMQJournalLogger.LOGGER.timeoutOnPollerShutdown(new Exception("trace")); } } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } super.stop(); } }
@Override public void stop() { if (timedBuffer != null) { timedBuffer.stop(); } if (isSupportsCallbacks() && writeExecutor != null) { writeExecutor.shutdown(); try { if (!writeExecutor.awaitTermination(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT, TimeUnit.SECONDS)) { ActiveMQJournalLogger.LOGGER.timeoutOnWriterShutdown(new Exception("trace")); } } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } }
@Override public MappedSequentialFileFactory setDatasync(boolean enabled) { super.setDatasync(enabled); return this; }
/** * Create the directory if it doesn't exist yet */ @Override public void createDirs() throws Exception { boolean ok = journalDir.mkdirs(); if (!ok && !journalDir.exists()) { IOException e = new IOException("Unable to create directory: " + journalDir); onIOError(e, e.getMessage(), null); throw e; } }
@Override public void stop() { if (timedBuffer != null) { timedBuffer.stop(); } if (isSupportsCallbacks() && writeExecutor != null) { writeExecutor.shutdown(); try { if (!writeExecutor.awaitTermination(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT, TimeUnit.SECONDS)) { ActiveMQJournalLogger.LOGGER.timeoutOnWriterShutdown(new Exception("trace")); } } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } }