/** * {@inheritDoc} * * @see org.modeshape.graph.observe.Observer#notify(org.modeshape.graph.observe.Changes) */ public void notify( Changes changes ) { if (changes != null) { // Broadcast the changes to the registered observers ... try { observers.broadcast(changes); } catch (RuntimeException t) { LOGGER.error(t, GraphI18n.errorNotifyingObserver, t.getLocalizedMessage()); } } }
protected byte[] computeHash( byte[] content ) { try { return SecureHash.getHash(ALGORITHM, content); } catch (NoSuchAlgorithmException e) { if (ALGORITHMS_NOT_FOUND_AND_LOGGED.add(ALGORITHM.digestName())) { Logger.getLogger(getClass()).error(e, GraphI18n.messageDigestNotFound, ALGORITHM.digestName()); } return NO_HASH; } }
protected byte[] computeHash( InputStream stream ) { try { return SecureHash.getHash(ALGORITHM, stream); } catch (NoSuchAlgorithmException e) { if (ALGORITHMS_NOT_FOUND_AND_LOGGED.add(ALGORITHM.digestName())) { Logger.getLogger(getClass()).error(e, GraphI18n.messageDigestNotFound, ALGORITHM.digestName()); } return NO_HASH; } catch (IOException e) { if (ALGORITHMS_NOT_FOUND_AND_LOGGED.add(ALGORITHM.digestName())) { Logger.getLogger(getClass()).error(e, GraphI18n.messageDigestNotFound, ALGORITHM.digestName()); } return NO_HASH; } }
protected byte[] computeHash( File file ) { try { return SecureHash.getHash(ALGORITHM, file); } catch (NoSuchAlgorithmException e) { if (ALGORITHMS_NOT_FOUND_AND_LOGGED.add(ALGORITHM.digestName())) { Logger.getLogger(getClass()).error(e, GraphI18n.messageDigestNotFound, ALGORITHM.digestName()); } return NO_HASH; } catch (IOException e) { if (ALGORITHMS_NOT_FOUND_AND_LOGGED.add(ALGORITHM.digestName())) { Logger.getLogger(getClass()).error(e, GraphI18n.messageDigestNotFound, ALGORITHM.digestName()); } return NO_HASH; } }
/** * Close this indexer and release all resources. This method has no effect if it is called when this indexer is alread closed. * * @see #isClosed() */ public void close() { if (closed) return; closed = true; // Close the channel ... try { channel.close(); } finally { // And shut down the executor service ... try { service.shutdown(); service.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { // Log this ... I18n msg = GraphI18n.errorShuttingDownExecutorServiceInSearchEngineIndexer; Logger.getLogger(getClass()).error(msg, sourceName); // Clear the interrupted status of the thread ... Thread.interrupted(); } finally { // Close the search engine processor ... processor.close(); } } }
@Override public void sequence( InputStream stream, SequencerOutput output, StreamSequencerContext context ) { try { ClassMetadata classMetadata = ClassFileMetadataReader.instance(stream); classFileRecorder.recordClass(context, output, classMetadata); } catch (Exception ex) { context.getLogger(getClass()).error(ex, ClassFileSequencerI18n.errorSequencingClass, context.getInputPath()); } }
private void cancelAllRequestsDueToError( Throwable t ) { LOGGER.error(t, GraphI18n.executingRequest, sourceName); try { for (Request request : this.composite.getRequests()) { try { request.cancel(); } finally { request.freeze(); } } cancel(true); } finally { this.composite.freeze(); } }
if (!clientPool.awaitTermination(5, TimeUnit.SECONDS)) { String msg = "Unable to shutdown clients after 5 seconds"; Logger.getLogger(RepositorySourceLoadHarness.class).error(MockI18n.passthrough, msg);
problems.addError(t, msg, source.getName(), t.getMessage()); } else { logger.error(msg, source.getName(), t.getMessage());
sequencerContext.getDestination().submit(); } catch (SequencerException e) { logger.error(e, RepositoryI18n.errorWhileSequencingNode, sequencerName, change); logger.error(RepositoryI18n.problemsWhileSequencingNode, sequencerName, change); problems.writeTo(logger); logger.error(e, RepositoryI18n.errorFindingSequencersToRunAgainstNode, changes);