@Override public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) { LOG.error("Exception caught by RejectedExecutionHandler for Runnable " + r + " and ThreadPoolExecutor " + executor); } }
@Override public boolean insert(final E element) { final boolean offered = this.queue.offer(element); if (!offered) { LOG.error( "Failed to add new monitoring record to queue. Queue is full. Either increase 'QueueSize' or change 'QueueFullBehavior' for the configured writer."); // NOCS return false; } else { return true; } }
private boolean enqueueRecord(final IMonitoringRecord record) { for (int tryNumber = 0; tryNumber < 10; tryNumber++) { // try up to 10 times to enqueue a record final boolean recordEnqueued = this.recordQueue.offer(record); if (recordEnqueued) { return true; } } LOG.error("Failed to add new monitoring record to queue (maximum number of attempts reached)."); return false; }
/** * Enqueues an unparsed registry record for processing. * * @param buffer * The unparsed data in an appropriately positioned byte buffer */ public void enqueueRegistryRecord(final ByteBuffer buffer) { try { this.queue.put(buffer); } catch (final InterruptedException e) { LOG.error("Record queue was interrupted", e); } }
private void logForecastModuleNotAvailableOrLoaded() { final IllegalStateException ise = new IllegalStateException("\"forecast\" package could not be loaded in R."); LOG.error("Could not load \"forecast\" package in R. Perhaps it is not installed in R?", ise); }
/** * Returns the value of the ThreadLocal variable threadLocalOutRequestIsEntryCall. * * @return the variable's value; true if value not set. */ public final boolean recallThreadLocalOutRequestIsEntryCall() { final Boolean curIsEntryCall = this.threadLocalOutRequestIsEntryCall.get(); if (curIsEntryCall == null) { LOG.error("isEntryCall has not been registered before"); return true; } return curIsEntryCall; }
private void send(final ByteBuffer buffer) { buffer.flip(); try { while (buffer.hasRemaining()) { this.socketChannel.write(buffer); } } catch (final IOException e) { LOG.error("Error on sending registry entry.", e); } buffer.clear(); }
private TraceEquivalenceClassModes extractTraceEquivalenceClassMode(final String traceEquivalenceCallModeString) { TraceEquivalenceClassModes extractedEquivalenceMode; try { extractedEquivalenceMode = TraceEquivalenceClassModes.valueOf(traceEquivalenceCallModeString); } catch (final IllegalArgumentException exc) { this.log.error("Error extracting enum value from String: '" + traceEquivalenceCallModeString + "'", exc); extractedEquivalenceMode = DEFAULT_EQUIVALENCE_MODE; } return extractedEquivalenceMode; }
@Override public Outcome onTermination() { try { this.terminated = true; this.connection.close(); return Outcome.SUCCESS; } catch (final IOException e) { LOG.error("IO error while trying to close the connection.", e); return Outcome.FAILURE; } }
@Override public void run() { while (true) { try { final ByteBuffer nextRecord = this.queue.take(); this.readRegistryRecord(nextRecord); } catch (final InterruptedException e) { LOG.error("Registry record handler was interrupted", e); } } }
@Override public void onTermination() { try { this.connection.close(); } catch (final IOException e) { LOG.error("Error closing connection", e); } }
@Override public void onTerminating() { try { this.send(this.byteBuffer); this.socketChannel.close(); } catch (final IOException ex) { LOG.error("Error on closing connection.", ex); } }
public final SystemModelRepository getSystemEntityFactory() { if (this.systemEntityFactory == null) { this.systemEntityFactory = (SystemModelRepository) this.getRepository(REPOSITORY_PORT_NAME_SYSTEM_MODEL); } if (this.systemEntityFactory == null) { LOG.error("Failed to connect to system model repository via repository port '" + REPOSITORY_PORT_NAME_SYSTEM_MODEL + "' (not connected?)"); } return this.systemEntityFactory; }
@Override public void terminate(final boolean error) { try { this.terminated = true; this.connection.close(); } catch (final IOException e) { this.log.error("IO error while trying to close the connection.", e); } }
@Override public void run() { while (true) { try { final ByteBuffer nextRecord = this.queue.take(); this.readRegularRecord(nextRecord); } catch (final InterruptedException e) { LOG.error("Regular record handler was interrupted", e); } } }
protected RBridgeControl() { final OutputStream out = new OutputStream2StandardLog(); try { this.rCon = Rsession.newLocalInstance(new PrintStream(out, true, "UTF-8"), null); } catch (final UnsupportedEncodingException e) { LOG.error(e.toString(), e); } }
@Override public final boolean newMonitoringRecord(final IMonitoringRecord record) { final boolean recordSent = this.insertBehavior.insert(record); if (!recordSent) { LOG.error("Error writing the monitoring data. Will terminate monitoring!"); this.terminate(); } return recordSent; }
public static final void monitorBranch(final int branchID, final int branchingOutcome) { if (!CTRLINST.isMonitoringEnabled()) { return; } // try-catch in order to avoid that any exception is propagated to the application code. try { CTRLINST.newMonitoringRecord(new BranchingRecord(TIMESOURCE.getTime(), branchID, branchingOutcome)); } catch (final Exception ex) { // NOPMD NOCS (Exceptions) LOG.error("Error monitoring branching", ex); } } }
/** * Used by {@link #getInstance()} to construct the singleton instance. */ private SigarSamplerFactory() { final Log log = LogFactory.getLog(SigarSamplerFactory.class); // access to static logger not possible in constructor final Sigar mySigar = new Sigar(); if (mySigar.getNativeLibrary() == null) { log.error("No Sigar native lib in java.library.path. See Sigar log for details (maybe only visible on Debug log-level)."); } final Humidor humidor = new Humidor(mySigar); this.sigar = humidor.getSigar(); }