/** * Logs out error message. * * @param msg Error message. */ default void error(String msg) { error(null, msg, null); }
/** * Logs error message with optional exception. * The default implementation calls {@code this.error(msg)}. * * @param marker Name of the marker to be associated with the message. * @param msg Error message. * @param e Optional exception (can be {@code null}). */ default void error(@Nullable String marker, String msg, @Nullable Throwable e) { error(msg, e); }
/** {@inheritDoc} */ @Override public void save(D d, String path) { try (FileOutputStream fos = new FileOutputStream(path)) { try (ObjectOutputStream outStream = new ObjectOutputStream(fos)) { outStream.writeObject(d); } } catch (IOException e) { if (log != null) log.error("Error opening file.", e); } }
@Override public void apply(IgniteInternalFuture<?> f) { try { f.get(); // Clean up the future from map only if there was no exception. // Otherwise flush() should fail. sentMsgs.remove(msgId); } catch (IgniteCheckedException e) { log.error("Failed to send message.", e); } } });
/** * Prints stack trace of the current thread to provided logger. * * @param log Logger. * @param msg Message to print with the stack. * * @deprecated Calls to this method should never be committed to master. */ @Deprecated public static void debugStack(IgniteLogger log, String msg) { log.error(msg, new Exception(debugPrefix() + msg)); }
/** {@inheritDoc} */ @Override public void close() throws IOException { for (TmpStorageInternal storage : chain) { try { storage.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } } }
@Override public Object call() { try { startGrid(); } catch (Exception e) { log().error("Grid start failed", e); fail(); } return null; } });
/** * Print collected messages. */ public void print() { for (String s : classes.keySet()) log.error(s); } }
@Override public void action(InputStream input, OutputStream output) throws IOException { output.write("Some response".getBytes()); log.error("TEST: Some response was sent to " + clientSock.getRemoteSocketAddress()); } };
/** {@inheritDoc} */ @Override public void onActivate(GridKernalContext kctx) { if (plugin != null) { try { plugin.start(); } catch (Exception e) { log.error("Can't start plugin", e); } } }
/** * @param msg Message to print. * @param t Error to print. */ protected void error(String msg, Throwable t) { log().error(msg, t); }
@Override public void beforeBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException { if (plugin != null) { try { plugin.start(); } catch (Exception e) { log.error("Can't start plugin", e); } } } }
/** * Release created data store for this partition. */ private void destroyCacheDataStore() { try { grp.offheap().destroyCacheDataStore(dataStore()); } catch (IgniteCheckedException e) { log.error("Unable to destroy cache data store on partition eviction [id=" + id + "]", e); } }
/** * @param log Logger. * @param latch Latch. * @throws Exception If failed. */ protected static void waitReconnectEvent(IgniteLogger log, CountDownLatch latch) throws Exception { if (!latch.await(RECONNECT_TIMEOUT, MILLISECONDS)) { log.error("Failed to wait for reconnect event, will dump threads, latch count: " + latch.getCount()); U.dumpThreads(log); fail("Failed to wait for disconnect/reconnect event."); } }
/** {@inheritDoc} */ @Override public void error(String msg, @Nullable Throwable t) { if (echo != null) echo.error(msg, t); applyListeners(msg); if (t != null) applyListeners(X.getFullStackTrace(t)); }
/** {@inheritDoc} */ @Override public void run() { IgniteInternalCache cache = ignite.context().cache().cache(name); try { cache.context().offheap().preloadPartition(part); } catch (IgniteCheckedException e) { log.error("Failed to preload the partition [cache=" + name + ", partition=" + part + ']', e); throw new IgniteException(e); } } }
/** {@inheritDoc} */ @Override protected void writeToSocket(Socket sock, OutputStream out, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException, IgniteCheckedException { boolean add = msgIds.add(msg.id()); if (checkDuplicates && !add && !(msg instanceof TcpDiscoveryMetricsUpdateMessage)) { log.error("Send duplicated message: " + msg); failed = true; } super.writeToSocket(sock, out, msg, timeout); } }
/** {@inheritDoc} */ @Override public void error(String msg) { if (testSensitiveEnabled()) testSensitive(msg); impl.error(enrich(msg)); }
@Override public void applyx(Transaction tx) throws IgniteCheckedException { try { IgniteFuture<Void> rollbackFut = tx.rollbackAsync(); rollbackFut.listen(fut -> tx.close()); } catch (Throwable t) { log.error("Exception on async rollback", t); throw new IgniteCheckedException("Rollback failed", t); } } };