/** * Clears the diagnostic context entries added by * <code>setMessageContext</code>. For this to work, the NDC has * to be in the same state as when <code>setMessageContext</code> * returned. * * @see setMessageContext */ public static void clearMessageContext() { MDC.remove(MDC_SESSION); NDC.pop(); }
return addresses; } finally { NDC.pop();
_loginFailures.incrementAndGet(); } finally { NDC.pop();
void doAuthPhase(LoginMonitor monitor, Subject subject, Set<Principal> principals, Set<Restriction> restrictionStore) throws AuthenticationException { Set<Object> publicCredentials = subject.getPublicCredentials(); Set<Object> privateCredentials = subject.getPrivateCredentials(); principals.addAll(subject.getPrincipals()); NDC.push("AUTH"); Result result = Result.FAIL; try { monitor.authBegins(publicCredentials, privateCredentials, principals); authStrategy.authenticate(monitor, publicCredentials, privateCredentials, principals, restrictionStore); result = Result.SUCCESS; } finally { NDC.pop(); monitor.authEnds(principals, result); } }
@Override public void run() { NDC.push(_remoteDomainInfo.toString()); try { CellMessage msg; while ((msg = _input.readObject()) != null) { getNucleus().sendMessage(msg, true, _allowForwardingOfRemoteMessages, false); _messagesToSystem.increment(); } } catch (AsynchronousCloseException | EOFException ignored) { } catch (ClassNotFoundException e) { _log.warn("Cannot deserialize object. This is most likely due to a version mismatch."); } catch (IOException e) { _log.warn("Error while reading from tunnel: {}", e.toString()); } finally { kill(); NDC.pop(); } }
Set<Object> doSessionPhase(LoginMonitor monitor, Set<Principal> principals) throws AuthenticationException { Set<Object> attributes = new HashSet<>(); NDC.push("SESSION"); Result result = Result.FAIL; try { monitor.sessionBegins(principals); sessionStrategy.session(monitor, principals, attributes); result = Result.SUCCESS; } finally { NDC.pop(); monitor.sessionEnds(principals, attributes, result); } return attributes; } }
void doMapPhase(LoginMonitor monitor, Set<Principal> principals) throws AuthenticationException { NDC.push("MAP"); Result result = Result.FAIL; try { monitor.mapBegins(principals); mapStrategy.map(monitor, principals); result = Result.SUCCESS; } finally { NDC.pop(); monitor.mapEnds(principals, result); } }
void doAccountPhase(LoginMonitor monitor, Set<Principal> principals) throws AuthenticationException { NDC.push("ACCOUNT"); Result result = Result.FAIL; try { monitor.accountBegins(principals); accountStrategy.account(monitor, principals); result = Result.SUCCESS; } finally { NDC.pop(); monitor.accountEnds(principals, result); } }
NDC.pop(); _status = "Terminated";
public LoginReply buildReply(LoginMonitor monitor, Subject originalSubject, Set<Principal> principals, Set<Object> attributes) throws AuthenticationException { Set<Object> publicCredentials = originalSubject.getPublicCredentials(); Set<Object> privateCredentials = originalSubject.getPrivateCredentials(); LoginReply reply = new LoginReply(); Subject subject = new Subject(false, principals, publicCredentials, privateCredentials); reply.setSubject(subject); reply.setSessionAttributes(attributes); Result result = Result.FAIL; String error = null; NDC.push("VALIDATION"); try { validationStrategy.validate(reply); result = Result.SUCCESS; } catch(AuthenticationException e) { error = e.getMessage(); throw e; } finally { NDC.pop(); monitor.validationResult(result, error); } return reply; }
@Override public void messageArrived(MessageEvent me) { if (me instanceof RoutedMessageEvent) { CellMessage msg = me.getMessage(); try { _messagesToTunnel.increment(); _output.writeObject(msg); } catch (IOException e) { NDC.push(_remoteDomainInfo.toString()); try { kill(); _log.warn("Error while sending message: {}", e.getMessage()); NoRouteToCellException noRoute = new NoRouteToCellException(msg, "Communication failure. Message could not be delivered."); CellMessage envelope = new CellMessage(msg.getSourcePath().revert(), noRoute); envelope.setLastUOID(msg.getUOID()); _nucleus.sendMessage(envelope, true, true, true); } finally { NDC.pop(); } } } else { super.messageArrived(me); } }