@Override public void onTerminating() { WriterUtil.flushBuffer(this.stringRegistryBuffer, this.registryRecordChannel, LOG); WriterUtil.flushBuffer(this.recordBuffer, this.monitoringRecordChannel, LOG); WriterUtil.close(this.registryRecordChannel, LOG); WriterUtil.close(this.monitoringRecordChannel, LOG); } }
@Override public boolean insert(final IMonitoringRecord element) { this.writer.writeMonitoringRecord(element); return true; }
/** * Used in tests only. */ @SuppressWarnings({ "PMD.DefaultPackage", "PMD.CommentDefaultAccessModifier" }) State getStateOfMonitoringWriterThread() { return this.monitoringWriterThread.getState(); } }
@Override public void waitForTermination(final long timeoutInMs) throws InterruptedException { if (this.monitoringWriterThread != null) { this.monitoringWriterThread.join(timeoutInMs); } }
@Override protected final void init() { LOGGER.debug("Initializing Writer Controller"); if (this.monitoringWriterThread != null) { this.monitoringWriterThread.start(); } }
@Override protected final void cleanup() { LOGGER.debug("Shutting down Writer Controller"); if (this.monitoringWriterThread != null) { this.monitoringWriterThread.terminate(); } // if (this.disruptor != null) { // this.disruptor.shutdown(); // } // LOG.info("block durations: {}" + this.insertBehavior.toString()); // System.out.println("block durations: " + this.insertBehavior.toString()); }
@Override public String toString() { final String configInfo = super.toString(); final StringBuilder builder = new StringBuilder() .append(configInfo) .append("\n\t") .append("Internal properties:") .append("\n\t\t") .append("Log location: ") .append(this.logFolder); return builder.toString(); }
public void flush(final ByteBuffer buffer, final Log log) { this.bytesWritten += WriterUtil.flushBuffer(buffer, this.channel, log); }
public void close() { WriterUtil.close(this.currentFileWriter, this.writerLog); }
public MonitoringWriterThread(final AbstractMonitoringWriter writer, final BlockingQueue<IMonitoringRecord> writerQueue) { if (writer == null) { throw new NullPointerException("The given writer may not be null."); } if (writerQueue == null) { throw new NullPointerException("The given writerQueue may not be null."); } this.writer = writer; this.writerQueue = writerQueue; // All Kieker threads must be daemon threads. Otherwise the monitored application can never terminate. this.setDaemon(true); }
@Override public void onTerminating() { // Always flush the registryBuffer before flushing the recordBuffer. // Otherwise the monitoring records could arrive before their string // records WriterUtil.flushBuffer(this.registryBuffer, this.socketChannel, LOG); WriterUtil.flushBuffer(this.buffer, this.socketChannel, LOG); WriterUtil.close(this.socketChannel, LOG); } }
@Override public boolean insert(final IMonitoringRecord element) { this.writer.writeMonitoringRecord(element); return true; }
/** * Used in tests only. */ // default State getStateOfMonitoringWriterThread() { // NOPMD (package-private) return this.monitoringWriterThread.getState(); } }
@Override public void waitForTermination(final long timeoutInMs) throws InterruptedException { if (this.monitoringWriterThread != null) { this.monitoringWriterThread.join(timeoutInMs); } }
@Override public String toString() { final String configInfo = super.toString(); final StringBuilder builder = new StringBuilder() .append(configInfo) .append("\n\t") .append("Internal properties:") .append("\n\t\t") .append("Log location: ") .append(this.logFolder); return builder.toString(); } }
@Override public void onTerminating() { WriterUtil.flushBuffer(this.stringRegistryBuffer, this.registryRecordChannel, LOGGER); WriterUtil.flushBuffer(this.recordBuffer, this.monitoringRecordChannel, LOGGER); WriterUtil.close(this.registryRecordChannel, LOGGER); WriterUtil.close(this.monitoringRecordChannel, LOGGER); } }
public static void writeMonitoringRecords(final AbstractMonitoringWriter writer, final int numRecords, final EmptyRecord record) { for (int i = 0; i < numRecords; i++) { writer.writeMonitoringRecord(record); } }
/** * Flushes the buffer and closes the channel afterwards. */ public void close(final ByteBuffer buffer, final Log log) { this.bytesWritten += WriterUtil.flushBuffer(buffer, this.channel, log); WriterUtil.close(this.channel, log); } }
@Override public void onTerminating() { // Always flush the registryBuffer before flushing the recordBuffer. Otherwise // the monitoring records could arrive before their string records WriterUtil.flushBuffer(this.registryBuffer, this.socketChannel, LOGGER); WriterUtil.flushBuffer(this.buffer, this.socketChannel, LOGGER); WriterUtil.close(this.socketChannel, LOGGER); } }
@Override public void onTerminating() { WriterUtil.flushBuffer(this.stringRegistryBuffer, this.registryRecordChannel, LOG); WriterUtil.flushBuffer(this.recordBuffer, this.monitoringRecordChannel, LOG); WriterUtil.close(this.registryRecordChannel, LOG); WriterUtil.close(this.monitoringRecordChannel, LOG); }