public void debug(Object message) { if (message instanceof String || this.logger.isDebugEnabled()) { this.logger.debug(String.valueOf(message)); } }
public void printMissingClasses() { int count = missingClasses.size(); if (count == 0) { return; } LOG.warn("Found {} references to unknown classes", count); if (LOG.isDebugEnabled()) { List<String> clsNames = new ArrayList<>(missingClasses); Collections.sort(clsNames); for (String cls : clsNames) { LOG.debug(" {}", cls); } } } }
static void logException(String msg, Exception e) { if (LOG.isDebugEnabled()) { LOG.debug(msg, e); } else { LOG.info(msg + ": " + e.getMessage()); } }
private void addCredentials(ReduceWork reduceWork, DAG dag) { Set<URI> fileSinkUris = new HashSet<URI>(); List<Node> topNodes = new ArrayList<Node>(); topNodes.add(reduceWork.getReducer()); collectFileSinkUris(topNodes, fileSinkUris); if (LOG.isDebugEnabled()) { for (URI fileSinkUri: fileSinkUris) { LOG.debug("Marking ReduceWork output URI as needing credentials: " + fileSinkUri); } } dag.addURIsForCredentials(fileSinkUris); }
private void stopUsingCurrentWriter() { if (currentWriter != null) { if (LOG.isDebugEnabled()) { LOG.debug("Stopping to use a writer after [" + Bytes.toString(currentWriterEndKey) + "] row; wrote out " + cellsInCurrentWriter + " kvs"); } cellsInCurrentWriter = 0; } currentWriter = null; currentWriterEndKey = (existingWriters.size() + 1 == boundaries.size()) ? null : boundaries.get(existingWriters .size() + 1); } }
private void printMergeMessageLog(MergedWarpMessage mergeMessage) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("merge msg size:" + mergeMessage.msgIds.size()); for (AbstractMessage cm : mergeMessage.msgs) { LOGGER.debug(cm.toString()); } StringBuffer sb = new StringBuffer(); for (long l : mergeMessage.msgIds) { sb.append(MSG_ID_PREFIX).append(l).append(SINGLE_LOG_POSTFIX); } sb.append("\n"); for (long l : futures.keySet()) { sb.append(FUTURES_PREFIX).append(l).append(SINGLE_LOG_POSTFIX); } LOGGER.debug(sb.toString()); } } }
@Override public void onCheckMessage(long msgId, ChannelHandlerContext ctx, ServerMessageSender sender) { try { sender.sendResponse(msgId, ctx.channel(), HeartbeatMessage.PONG); } catch (Throwable throwable) { LOGGER.error("", "send response error", throwable); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("received PING from " + ctx.channel().remoteAddress()); } }
@Override public void initializeState(StateInitializationContext context) throws Exception { super.initializeState(context); checkState(checkpointedState == null, "The reader state has already been initialized."); checkpointedState = context.getOperatorStateStore().getSerializableListState("splits"); int subtaskIdx = getRuntimeContext().getIndexOfThisSubtask(); if (context.isRestored()) { LOG.info("Restoring state for the {} (taskIdx={}).", getClass().getSimpleName(), subtaskIdx); // this may not be null in case we migrate from a previous Flink version. if (restoredReaderState == null) { restoredReaderState = new ArrayList<>(); for (TimestampedFileInputSplit split : checkpointedState.get()) { restoredReaderState.add(split); } if (LOG.isDebugEnabled()) { LOG.debug("{} (taskIdx={}) restored {}.", getClass().getSimpleName(), subtaskIdx, restoredReaderState); } } } else { LOG.info("No state to restore for the {} (taskIdx={}).", getClass().getSimpleName(), subtaskIdx); } }
@Override protected void handleGetTopicsOfNamespaceSuccess(CommandGetTopicsOfNamespaceResponse success) { checkArgument(state == State.Ready); long requestId = success.getRequestId(); List<String> topics = success.getTopicsList(); if (log.isDebugEnabled()) { log.debug("{} Received get topics of namespace success response from server: {} - topics.size: {}", ctx.channel(), success.getRequestId(), topics.size()); } CompletableFuture<List<String>> requestFuture = pendingGetTopicsRequests.remove(requestId); if (requestFuture != null) { requestFuture.complete(topics); } else { log.warn("{} Received unknown request id from server: {}", ctx.channel(), success.getRequestId()); } }
@Override public void initializeState(FunctionInitializationContext context) throws Exception { Preconditions.checkArgument(this.restoredBucketStates == null, "The " + getClass().getSimpleName() + " has already been initialized."); try { initFileSystem(); } catch (IOException e) { LOG.error("Error while creating FileSystem when initializing the state of the RollingSink.", e); throw new RuntimeException("Error while creating FileSystem when initializing the state of the RollingSink.", e); } if (this.refTruncate == null) { this.refTruncate = reflectTruncate(fs); } OperatorStateStore stateStore = context.getOperatorStateStore(); restoredBucketStates = stateStore.getSerializableListState("rolling-states"); int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); if (context.isRestored()) { LOG.info("Restoring state for the {} (taskIdx={}).", getClass().getSimpleName(), subtaskIndex); for (BucketState bucketState : restoredBucketStates.get()) { handleRestoredBucketState(bucketState); } if (LOG.isDebugEnabled()) { LOG.debug("{} (taskIdx= {}) restored {}", getClass().getSimpleName(), subtaskIndex, bucketState); } } else { LOG.info("No state to restore for the {} (taskIdx= {}).", getClass().getSimpleName(), subtaskIndex); } }
@Override protected void rebalanceCache() { try { getLogger().info("Rebalancing: " + this.cache); RebalanceResults results = RegionHelper.rebalanceCache(this.cache); if (getLogger().isDebugEnabled()) { getLogger().debug("Done rebalancing: " + this.cache); getLogger().debug(RegionHelper.getRebalanceResultsMessage(results)); } } catch (Exception e) { getLogger().warn("Rebalance failed because of the following exception:", e); } }
@Override public void onSubscribe(Subscription s) { if (LOG.isDebugEnabled()) { LOG.info("onSubscribe"); } sa.setSubscription(s); }
void expire(final FlowFile flowFile, final String details) { try { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.EXPIRE).setDetails(details).build(); events.add(record); } catch (final Exception e) { logger.error("Failed to generate Provenance Event due to " + e); if (logger.isDebugEnabled()) { logger.error("", e); } } }
/** * Queue a call for sending. * * If the AdminClient thread has exited, this will fail. Otherwise, it will succeed (even * if the AdminClient is shutting down). This function should called when retrying an * existing call. * * @param call The new call object. * @param now The current time in milliseconds. */ void enqueue(Call call, long now) { if (log.isDebugEnabled()) { log.debug("Queueing {} with a timeout {} ms from now.", call, call.deadlineMs - now); } boolean accepted = false; synchronized (this) { if (newCalls != null) { newCalls.add(call); accepted = true; } } if (accepted) { client.wakeup(); // wake the thread if it is in poll() } else { log.debug("The AdminClient thread has exited. Timing out {}.", call); call.fail(Long.MAX_VALUE, new TimeoutException("The AdminClient thread has exited.")); } }
private static boolean[] pickStripesInternal(SearchArgument sarg, int[] filterColumns, List<StripeStatistics> stripeStats, int stripeCount, Path filePath, final SchemaEvolution evolution) { boolean[] includeStripe = new boolean[stripeCount]; for (int i = 0; i < includeStripe.length; ++i) { includeStripe[i] = (i >= stripeStats.size()) || isStripeSatisfyPredicate(stripeStats.get(i), sarg, filterColumns, evolution); if (LOG.isDebugEnabled() && !includeStripe[i]) { LOG.debug("Eliminating ORC stripe-" + i + " of file '" + filePath + "' as it did not satisfy predicate condition."); } } return includeStripe; }
@Override public InputSplit getNextInputSplit(String host, int taskId) { InputSplit next = null; // keep the synchronized part short synchronized (this.splits) { if (this.splits.size() > 0) { next = this.splits.remove(this.splits.size() - 1); } } if (LOG.isDebugEnabled()) { if (next == null) { LOG.debug("No more input splits available"); } else { LOG.debug("Assigning split " + next + " to " + host); } } return next; } }
private void logException(Throwable cause) { //handling connection reset by peer exceptions if (cause instanceof IOException && IGNORABLE_ERROR_MESSAGE.matcher(cause.getMessage()).matches()) { if (LOG.isDebugEnabled()) { LOG.debug("Swallowed an IOException caused by client connectivity: " + cause.getMessage(), cause); } } else { if (LOG.isErrorEnabled()) { LOG.error("Unexpected error occurred: " + cause.getMessage(), cause); } } }
@Override public Response toResponse(NoConnectedNodesException ex) { // log the error logger.info(String.format("Cluster failed processing request: %s. Returning %s response.", ex, Response.Status.INTERNAL_SERVER_ERROR)); if (logger.isDebugEnabled()) { logger.debug(StringUtils.EMPTY, ex); } return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Action was performed, but no nodes are connected.").type("text/plain").build(); }
/** * Trigger a browser redirect * * @param location Where to redirect */ public void redirect(String location) { if (LOG.isDebugEnabled()) { LOG.debug("Redirecting ({} {} to {}", "Found", HttpServletResponse.SC_FOUND, location); } try { response.sendRedirect(location); } catch (IOException ioException) { LOG.warn("Redirect failure", ioException); } }
public void debug(Object message, Throwable exception) { if (message instanceof String || this.logger.isDebugEnabled()) { this.logger.debug(String.valueOf(message), exception); } }