@Override public void setHadoopCallerContext(String callerContext) { CallerContext.setCurrent(new CallerContext.Builder(callerContext).build()); }
CallerContext callerContext = CallerContext.getCurrent(); if (callerContext != null && callerContext.isContextValid()) { RPCCallerContextProto.Builder contextBuilder = RPCCallerContextProto .newBuilder().setContext(callerContext.getContext()); if (callerContext.getSignature() != null) { contextBuilder.setSignature( ByteString.copyFrom(callerContext.getSignature()));
public CallerContext build() { return new CallerContext(this); } }
if (CallerContext.getCurrent() == null) { CallerContext ctx = new CallerContext.Builder("CLI").build(); CallerContext.setCurrent(ctx);
private static void appendCallerContext(StringBuilder sb, CallerContext callerContext) { String context = null; byte[] signature = null; if (callerContext != null) { context = callerContext.getContext(); signature = callerContext.getSignature(); } if (context != null) { add(Keys.CALLERCONTEXT, context, sb); } if (signature != null) { try { String sigStr = new String(signature, "UTF-8"); add(Keys.CALLERSIGNATURE, sigStr, sb); } catch (UnsupportedEncodingException e) { // ignore this signature } } }
if (isCallerContextEnabled && callerContext != null && callerContext.isContextValid()) { sb.append("\t").append("callerContext="); if (callerContext.getContext().length() > callerContextMaxLen) { sb.append(callerContext.getContext().substring(0, callerContextMaxLen)); } else { sb.append(callerContext.getContext()); if (callerContext.getSignature() != null && callerContext.getSignature().length > 0 && callerContext.getSignature().length <= callerSignatureMaxLen) { sb.append(":"); sb.append(new String(callerContext.getSignature(), CallerContext.SIGNATURE_ENCODING));
private void logAuditEvent(boolean succeeded, UserGroupInformation ugi, InetAddress addr, String cmd, String src, String dst, FileStatus status) { final String ugiStr = ugi.toString(); for (AuditLogger logger : auditLoggers) { if (logger instanceof HdfsAuditLogger) { HdfsAuditLogger hdfsLogger = (HdfsAuditLogger) logger; hdfsLogger.logAuditEvent(succeeded, ugiStr, addr, cmd, src, dst, status, CallerContext.getCurrent(), ugi, dtSecretManager); } else { logger.logAuditEvent(succeeded, ugiStr, addr, cmd, src, dst, status); } } }
attemptState.getAppAttemptTokens() .getSecretKey(RMStateStore.AM_CLIENT_TOKEN_MASTER_KEY_NAME)); assertEquals("context", appState.getCallerContext().getContext());
@Override public String toString() { if (!isContextValid()) { return ""; } String str = context; if (signature != null) { str += ":"; str += new String(signature, SIGNATURE_ENCODING); } return str; }
@Override public void setCallerContext(CallerContext callerContext) { if (callerContext != null) { maybeInitBuilder(); RpcHeaderProtos.RPCCallerContextProto.Builder b = RpcHeaderProtos.RPCCallerContextProto .newBuilder(); if (callerContext.getContext() != null) { b.setContext(callerContext.getContext()); } if (callerContext.getSignature() != null) { b.setSignature(ByteString.copyFrom(callerContext.getSignature())); } builder.setCallerContext(b); } }
if (CallerContext.getCurrent() == null) { CallerContext ctx = new CallerContext.Builder("CLI").build(); CallerContext.setCurrent(ctx);
CallerContext callerContext = CallerContext.getCurrent();
@Override public String toString() { if (!isContextValid()) { return ""; } String str = context; if (signature != null) { str += ":"; str += new String(signature, SIGNATURE_ENCODING); } return str; }
if (callerContext.getContext() != null) { expLog.append("\tCALLERCONTEXT=context"); if (callerContext.getSignature() != null) { expLog.append("\tCALLERSIGNATURE=signature");
CallerContext callerContext = CallerContext.getCurrent(); if (callerContext != null && callerContext.isContextValid()) { RPCCallerContextProto.Builder contextBuilder = RPCCallerContextProto .newBuilder().setContext(callerContext.getContext()); if (callerContext.getSignature() != null) { contextBuilder.setSignature( ByteString.copyFrom(callerContext.getSignature()));
CallerContext.setCurrent(call.callerContext); UserGroupInformation remoteUser = call.getRemoteUser(); if (remoteUser != null) {
.getApplicationSubmissionContext(); ApplicationId applicationId = submissionContext.getApplicationId(); CallerContext callerContext = CallerContext.getCurrent();
public CallerContext build() { return new CallerContext(this); } }
app.getAppNodeLabelExpression()); if (app.getCallerContext() != null) { if (app.getCallerContext().getContext() != null) { entityInfo.put(ApplicationMetricsConstants.YARN_APP_CALLER_CONTEXT, app.getCallerContext().getContext()); if (app.getCallerContext().getSignature() != null) { entityInfo.put(ApplicationMetricsConstants.YARN_APP_CALLER_SIGNATURE, app.getCallerContext().getSignature());
@Override protected void serviceStop() throws Exception { LOG.info("Stopping {}", getName()); stopExecutors.set(true); if (executor != null) { executor.shutdown(); if (executor.isTerminating()) { LOG.info("Waiting for executor to terminate"); boolean terminated = executor.awaitTermination(10, TimeUnit.SECONDS); if (terminated) { LOG.info("Executor terminated"); } else { LOG.warn("Executor did not terminate"); executor.shutdownNow(); } } } synchronized (cachedLogs) { for (EntityCacheItem cacheItem : cachedLogs.values()) { ServiceOperations.stopQuietly(cacheItem.getStore()); } } CallerContext.setCurrent(null); super.serviceStop(); }