/** * @param ackTimeout Acknowledgement timeout. * @return {@code True} if acknowledgement timeout is less or equal to * maximum acknowledgement timeout, {@code false} otherwise. */ private boolean checkAckTimeout(long ackTimeout) { if (ackTimeout > maxAckTimeout) { LT.warn(log, null, "Acknowledgement timeout is greater than maximum acknowledgement timeout " + "(consider increasing 'maxAckTimeout' configuration property) " + "[ackTimeout=" + ackTimeout + ", maxAckTimeout=" + maxAckTimeout + ']'); return false; } return true; }
/** * Validates that cache key or cache value implements {@link Externalizable} * * @param log Logger used to log warning message. * @param obj Cache key or cache value. */ private static void validateExternalizable(GridLogger log, Object obj) { Class<?> cls = obj.getClass(); if (!cls.isArray() && !U.isJdk(cls) && !(obj instanceof Externalizable) && !(obj instanceof GridCacheInternal)) LT.warn(log, null, "For best performance you should implement " + "java.io.Externalizable for all cache keys and values: " + cls.getName()); }
/** * Starts chain notification from head to tail. * * @param ses Session in which GridNioException was caught. * @param e GridException instance. */ @Override public void onExceptionCaught(GridNioSession ses, GridException e) { try { head.onExceptionCaught(ses, e); } catch (Exception ex) { LT.warn(log, ex, "Failed to forward GridNioException to filter chain [ses=" + ses + ", e=" + e + ']'); } }
LT.warn(log, null, "Timed out waiting for message delivery receipt (most probably, the reason is " + "in long GC pauses on remote node; consider tuning GC and increasing 'ackTimeout' " + "configuration property). Will retry to send message with increased timeout. " +
LT.warn(log, null, "Timed out waiting for message to be read (most probably, the reason is " + "in long GC pauses on remote node. Current timeout: " + timeout + '.');
/** {@inheritDoc} */ @Override public void onMessageReceived(GridNioSession ses, Object msg) throws GridException { if (!(msg instanceof ByteBuffer)) throw new GridNioException("Failed to decode incoming message (incoming message is not a byte buffer, " + "is filter properly placed?): " + msg.getClass()); try { ByteBuffer input = (ByteBuffer)msg; while (input.hasRemaining()) { Object res = parser.decode(ses, input); if (res != null) proceedMessageReceived(ses, res); else { if (input.hasRemaining()) { if (directMode) return; LT.warn(log, null, "Parser returned null but there are still unread data in input buffer (bug in " + "parser code?) [parser=" + parser + ", ses=" + ses + ']'); input.position(input.limit()); } } } } catch (IOException e) { throw new GridNioException(e); } }
@Override public void onSessionWriteTimeout(GridNioSession ses) { LT.warn(log, null, "Communication SPI Session write timed out (consider increasing " + "'socketWriteTimeout' " + "configuration property) [remoteAddr=" + ses.remoteAddress() + ", writeTimeout=" + sockWriteTimeout + ']'); if (log.isDebugEnabled()) log.debug("Closing communication SPI session on write timeout [ses=" + ses + ", writeTimeout=" + sockWriteTimeout + ']'); ses.close(); }
LT.warn(log, e, "Failed to get fragmentizer file info (will retry)."); else { if (log.isDebugEnabled())
LT.warn(log, e, "Failed to get fragmentizer file info (will retry)."); else { if (log.isDebugEnabled())
LT.warn(log, null, "Socket write has timed out (consider increasing " + "'sockTimeout' configuration property) [sockTimeout=" + sockTimeout + ']');
/** * @return Message that is in the head of the queue, {@code null} if queue is empty. */ @Nullable GridNioFuture<?> pollFuture() { GridNioFuture<?> last = queue.poll(); if (last != null) { queueSize.decrementAndGet(); if (sem != null && !last.messageThread()) sem.release(); if (recovery != null) { if (!recovery.add(last)) { LT.warn(log, null, "Unacknowledged messages queue size overflow, will attempt to reconnect " + "[remoteAddr=" + remoteAddress() + ", queueLimit=" + recovery.queueLimit() + ']'); if (log.isDebugEnabled()) log.debug("Unacknowledged messages queue size overflow, will attempt to reconnect " + "[remoteAddr=" + remoteAddress() + ", queueSize=" + recovery.messagesFutures().size() + ", queueLimit=" + recovery.queueLimit() + ']'); close(); } } } return last; }
LT.warn(log, null, longMsg, msg);
/** {@inheritDoc} */ @Override public boolean pingNode(UUID nodeId) { assert nodeId != null; if (nodeId == locNodeId) return true; GridTcpDiscoveryNode node = ring.node(nodeId); if (node == null || !node.visible()) return false; boolean res = pingNode(node); if (!res) { LT.warn(log, null, "Failed to ping node (status check will be initiated): " + nodeId); msgWorker.addMessage(new GridTcpDiscoveryStatusCheckMessage(locNode, node.id())); } return res; }
/** * Adds partition unload event. * * @param part Partition. */ public void addUnloadEvent(int part) { if (!cctx.events().isRecordable(EVT_CACHE_PRELOAD_PART_UNLOADED)) LT.warn(log, null, "Added event without checking if event is recordable: " + U.gridEventName(EVT_CACHE_PRELOAD_PART_UNLOADED)); cctx.gridEvents().record(new GridCachePreloadingEvent(cctx.name(), cctx.localNode(), "Cache unloading event.", EVT_CACHE_PRELOAD_PART_UNLOADED, part, null, 0, 0)); }
ses.close(); LT.warn(log, null, "Unknown connection detected (is some other software connecting to this " + "GridGain port?) [rmtAddr=" + ses.remoteAddress() + ", locAddr=" + ses.localAddress() + ']');
/** * Adds preloading event. * * @param part Partition. * @param type Event type. * @param discoNode Discovery node. * @param discoType Discovery event type. * @param discoTs Discovery event timestamp. */ public void addPreloadEvent(int part, int type, GridNode discoNode, int discoType, long discoTs) { assert discoNode != null; assert type > 0; assert discoType > 0; assert discoTs > 0; if (!cctx.events().isRecordable(type)) LT.warn(log, null, "Added event without checking if event is recordable: " + U.gridEventName(type)); cctx.gridEvents().record(new GridCachePreloadingEvent(cctx.name(), cctx.localNode(), "Cache preloading event.", type, part, discoNode, discoType, discoTs)); }
/** * @param node Node to create client for. * @return Client. * @throws GridException If failed. */ @Nullable protected GridCommunicationClient createNioClient(GridNode node) throws GridException { assert node != null; Integer shmemPort = node.attribute(createSpiAttributeName(ATTR_SHMEM_PORT)); GridNode locNode = getSpiContext().localNode(); if (locNode == null) throw new GridException("Failed to create NIO client (local node is stopping)"); // If remote node has shared memory server enabled and has the same set of MACs // then we are likely to run on the same host and shared memory communication could be tried. if (shmemPort != null && U.sameMacs(locNode, node)) { try { return createShmemClient(node, shmemPort); } catch (GridException e) { if (e.hasCause(GridIpcOutOfSystemResourcesException.class)) // Has cause or is itself the GridIpcOutOfSystemResourcesException. LT.warn(log, null, OUT_OF_RESOURCES_TCP_MSG); else if (getSpiContext().node(node.id()) != null) LT.warn(log, null, e.getMessage()); else if (log.isDebugEnabled()) log.debug("Failed to establish shared memory connection with local node (node has left): " + node.id()); } } return createTcpClient(node); }
/** * Requests time from remote node. * * @param rmtNodeId Remote node ID. */ private void requestTime(UUID rmtNodeId) { GridNode node = ctx.discovery().node(rmtNodeId); if (node != null) { InetAddress addr = node.attribute(ATTR_TIME_SERVER_HOST); int port = node.attribute(ATTR_TIME_SERVER_PORT); try { GridClockMessage req = new GridClockMessage(ctx.localNodeId(), rmtNodeId, currentTime(), 0); srv.sendPacket(req, addr, port); } catch (GridException e) { LT.warn(log, e, "Failed to send time request to remote node [rmtNodeId=" + rmtNodeId + ", addr=" + addr + ", port=" + port + ']'); } } else onNodeLeft(rmtNodeId); }
/** * Checks segment on start waiting for correct segment if necessary. * * @throws GridException If check failed. */ private void checkSegmentOnStart() throws GridException { assert hasRslvrs; if (log.isDebugEnabled()) log.debug("Starting network segment check."); while (true) { if (ctx.segmentation().isValidSegment()) break; if (ctx.config().isWaitForSegmentOnStart()) { LT.warn(log, null, "Failed to check network segment (retrying every 2000 ms)."); // Wait and check again. U.sleep(2000); } else throw new GridException("Failed to check network segment."); } if (log.isDebugEnabled()) log.debug("Finished network segment check successfully."); }
/** * Records event if it's recordable. * * @param evt Event to record. */ public void record(GridEvent evt) { assert evt != null; if (!enterBusy()) return; try { int type = evt.type(); if (!isRecordable(type)) { LT.warn(log, null, "Trying to record event without checking if it is recordable: " + U.gridEventName(type)); } // Override user recordable settings for daemon node. if ((isDaemon || isUserRecordable(type)) && !isHiddenEvent(type)) try { getSpi().record(evt); } catch (GridSpiException e) { U.error(log, "Failed to record event: " + evt, e); } if (isRecordable(type)) notifyListeners(evt); } finally { leaveBusy(); } }