/*
@see com.ibm.wsspi.session.IStore#runInvalidation()
method called by the Invalidator to perform
background Invalidation Processing
499029
@Override
    public void runInvalidation() {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[RUN_INVALIDATION], appNameForLogging);
        }
        /*
         * if (_isApplicationSessionStore) {
         * runApplicationStoreInvalidation();
         * } else {
         */
        long nowTime = System.currentTimeMillis();
        Iterator iter = _sessions.keySet().iterator();
        try {
            //setThreadContext threw a NPE because we were trying to get the config from within getModuleMetaData and it was returning null
            //this only happens after the app has been shutdown.  There was a small timing window where this was possible.
            //Anyway, we're going to check for isInProcessOfStopping, but there could still be a timing window.  So, we are going to call a different
            //setThreadContext method that will not log the errors and we will log it here only if we are not in the process of stopping  
            if (this.isInProcessOfStopping()) { 
                if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[RUN_INVALIDATION], "application in the process of stopping - " + appNameForLogging);
                }
                return;
            }
            // PK99859: Set the thread context
            try {
                setThreadContextDuringRunInvalidation();
            } catch (RuntimeException e) {
                if (!this.isInProcessOfStopping()) {
                    //the exception is only expected if we are in the process of stopping the application
                    //therefore, if we have not stopped the app, report the error
                    LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, MemoryStore.class.getSimpleName(), methodNames[RUN_INVALIDATION], "CommonMessage.exception", e);
                }
                return;
            }
            while (iter.hasNext()) {
                String key = (String) iter.next();
                ISession s = (ISession) _sessions.get(key);

                // sync on the session and check if its active...
                if (s != null) {
                    synchronized (s) {
                        if (s.isValid()) {
                            if (s.getMaxInactiveInterval() != -1) {
                                long currentAccessTime = s.getCurrentAccessTime(); // currentAccessTime
                                                                                   // updated on
                                                                                   // session
                                                                                   // access
                                                                                   // lastAccessedTime
                                                                                   // updated at
                                                                                   // releaseSession
                                long maxinact = 1000 * (long) s.getMaxInactiveInterval();
                                boolean active = s.getRefCount() > 0;
                                if (_isApplicationSessionStore) {
                                    // the RefCount is not correct when dealing with an
                                    // applicationSessionStore
                                    s.setRefCount(0);
                                    active = false;
                                }
                                boolean timedOut = (currentAccessTime <= nowTime - maxinact);
                                /*
                                 * invalidate if:
                                 * session has timedOut AND (is not active OR (the Invalidation
                                 * Multiple has not been set to 0
                                 * and the session is that many times the invalidation interval)
                                 * 
                                 * The default value for the invalidation interval is 3.
                                 * 
                                 * PK03711 removed check for active and always invalidated
                                 * timedout sessions for v6.1 and earlier
                                 * v7 CTS defect 391577 forced us to put this code back, so we
                                 * introduced the InvalidateIfActive property
                                 * In the service stream, the ForceSessionInvalidationMultiple was
                                 * used, so we are using the same property
                                 */
                                if ((timedOut)
                                    && ((!active) || ((_smc.getForceSessionInvalidationMultiple() != 0) && (currentAccessTime <= nowTime
                                                                                                                                 - (_smc.getForceSessionInvalidationMultiple() * maxinact))))) {

                                    _storeCallback.sessionInvalidatedByTimeout(s);
                                    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
                                        String message = "Going to invalidate session with id=" + s.getId();
                                        LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[RUN_INVALIDATION], message);
                                    }
                                    s.invalidate();
                                }
                            }
                        } // isValid
                    }
                }
            } // end "while"
        } finally {
            // PK99859: Unset the thread context
            unsetThreadContext();
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[RUN_INVALIDATION]);
        }
    }
674957
public void invalidate() {
        if (mInvalid.compareAndSet(false, true)) {
            for (InvalidatedCallback callback : mOnInvalidatedCallbacks) {
                callback.onInvalidated();
            }
        }
    }
874250
@SuppressWarnings("unchecked")
    protected void validate() {

        if (m_ou == null) {
            m_name.removeAllValidators();
            m_name.addValidator(new NameValidator());
        }
        m_description.setRequired(true);
        m_description.setRequiredError("Required");

        if (m_ouResources.getRows().isEmpty() & !m_webuser.getValue().booleanValue()) {
            CmsPathSelectField field = new CmsPathSelectField();
            field.setUseRootPaths(true);
            field.setCmsObject(m_cms);
            m_ouResources.addRow(field);
        }
        for (I_CmsEditableGroupRow row : m_ouResources.getRows()) {
            ((AbstractField<String>)row.getComponent()).removeAllValidators();
            ((AbstractField<String>)row.getComponent()).addValidator(new ResourceValidator());
        }
    }
826867
@Override
	public void validate() throws HostNameException {
		if(parsedHost != null) {
			return;
		}
		if(validationException != null) {
			throw validationException;
		}
		synchronized(this) {
			if(parsedHost != null) {
				return;
			}
			if(validationException != null) {
				throw validationException;
			}
			try {
				parsedHost = getValidator().validateHost(this);
			} catch(HostNameException e) {
				validationException = e;
				throw e;
			}
		}
	}
1270730
@Override
  public void run() {
    List<CompactionVerifier> verifiers = this.suite.getMapReduceVerifiers();
    for (CompactionVerifier verifier : verifiers) {
      if (!verifier.verify(dataset).isSuccessful()) {
        log.error("Verification {} for {} is not passed.", verifier.getName(), dataset.datasetURN());
        this.onMRTaskComplete (false, new IOException("Compaction verification for MR is failed"));
        return;
      }
    }

    super.run();
  }
1244885
public void internalInvalidate(boolean timeoutOccurred) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[INTERNAL_INVALIDATE], appNameAndIdString);
        }
        //if it's not valid, just return
        if (_isValid) {
            //sets the Thread's context (classLoader) so that we can handle app specific listeners
            try {
                _store.setThreadContext();
                // PM11279: Call callInvalidateFromInternalInvalidate, which is overridden in MTMSesion
                callInvalidateFromInternalInvalidate();
                if (timeoutOccurred) {
                    _storeCallback.sessionInvalidatedByTimeout(this);
                }
            } finally {
                _store.unsetThreadContext();
            }
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[INTERNAL_INVALIDATE]);
        }
    }
1338528
public void onReadyToInvalidate() {

        if (isB2BUAOrphan()) {
            logger.debug("Session is B2BUA Orphaned, lets invalidate");
            setReadyToInvalidate(true);
        }

        if (!readyToInvalidate) {
            logger.debug("Session not ready to invalidate, wait next chance.");
            return;
        }

        boolean allDerivedReady = true;
        Iterator<MobicentsSipSession> derivedSessionsIterator = this.getDerivedSipSessions();
        while (derivedSessionsIterator.hasNext()) {
                MobicentsSipSession mobicentsSipSession = (MobicentsSipSession) derivedSessionsIterator
                                .next();
                boolean derivedIsOrphaned = mobicentsSipSession.isB2BUAOrphan();
                boolean derivedReady = !mobicentsSipSession.isValid() || derivedIsOrphaned;
                allDerivedReady = allDerivedReady & derivedReady;
        }

            if(logger.isDebugEnabled()) {
                String msg = String.format("Session [%s] onReadyToInvalidate, hasParent [%s], hasDerivedSessions [%s], will invalidate [%s]", key, parentSession != null, derivedSipSessions != null, allDerivedReady);
                logger.debug(msg);
            }

        if (!allDerivedReady) {
            logger.debug("Cant invalidate yet, lets wait until all derived to be ready.");
            return;
        } else {
            logger.debug("All Derived ready, lets proceed.");
            }

    	if(logger.isDebugEnabled()) {
    		logger.debug("invalidateWhenReady flag is set to " + invalidateWhenReady);
    	}

    	if(isValid() && this.invalidateWhenReady) {
    		this.notifySipSessionListeners(SipSessionEventType.READYTOINVALIDATE);
    		//If the application does not explicitly invalidate the session in the callback or has not defined a listener,
        	//the container will invalidate the session.
        	if(isValid()) {
        		invalidate(true);
        	}
    	}
    }
1371276
protected void validateRewrite() {

        CmsRpcAction<CmsRewriteAliasValidationReply> action = new CmsRpcAction<CmsRewriteAliasValidationReply>() {

            @Override
            public void execute() {

                start(200, true);
                List<CmsRewriteAliasTableRow> rowsToValidate = new ArrayList<CmsRewriteAliasTableRow>();
                rowsToValidate.addAll(m_view.getRewriteData());

                CmsRewriteAliasValidationRequest request = new CmsRewriteAliasValidationRequest(rowsToValidate);
                getService().validateRewriteAliases(request, this);
            }

            @Override
            public void onResponse(CmsRewriteAliasValidationReply result) {

                stop(false);
                m_view.update(result);
                updateValidationStatus();
            }

        };
        action.execute();
    }
222930
@Override
    public void invalidate() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Invalidating session; " + this);
        }
        this.valid = false;
        destroy();
    }
613542
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSBoolean ntpd_status_validator = new MPSBoolean();
		ntpd_status_validator.validate(operationType, ntpd_status, "\"ntpd_status\"");
		
	}
1248073
public static void validateReservedDatastream(PID pid,
                                                  String dsId,
                                                  Datastream ds)
            throws ValidationException {

        // NB: only want to generate inputstream from .getContentStream() once
        // we know that this is a datastream to validate
        // to prevent reading of non-reserved datstream content when it is not needed
        InputStream content = null;

        try {
        if ("POLICY".equals(dsId)) {
            content = ds.getContentStream();
            validatePOLICY(content);
        } else if ("FESLPOLICY".equals(dsId)) {
            content = ds.getContentStream();
            validateFESLPOLICY(content);
        } else if ("RELS-EXT".equals(dsId) || "RELS-INT".equals(dsId)) {
                content = ds.getContentStream();
            validateRELS(pid, dsId, content);
            }
        } catch (StreamIOException e) {
            throw new ValidationException("Failed to get content stream for " + pid + "/" + dsId + ": " + e.getMessage(), e);
        }

        if (content != null) {
            try {
                content.close();
            } catch (IOException e) {
                throw new ValidationException("Error closing content stream for " + pid + "/" + dsId + ": " + e.getMessage(), e);
            }
        }
    }
1001985
protected void markInvalid()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"markInvalid");
      invalid = true;
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"markInvalid");
   }
1246490
public void setValidating(boolean isValidating) {
        if (isValidating)
            MCWrapper.isValidating.set(true);
        else
            MCWrapper.isValidating.remove();
    }
1146373
private void executeValidate(FacesContext context) {
        try {
            validate(context);
        } catch (RuntimeException e) {
            context.renderResponse();
            throw e;
        }

        if (!isValid()) {
            context.validationFailed();
            context.renderResponse();
        }
    }
182344
def RunValidationOutputToConsole(feed, options):
  """"""
  accumulator = CountingConsoleProblemAccumulator(
      options.error_types_ignore_list)
  problems = transitfeed.ProblemReporter(accumulator)
  _, exit_code = RunValidation(feed, options, problems)
  return exit_code
890208
@Nonnull
  public static EChange safeInvalidateSession (@Nullable final HttpSession aSession)
  {
    if (aSession != null)
    {
      try
      {
        if (LOGGER.isDebugEnabled ())
          LOGGER.debug ("Invalidating session " + aSession.getId ());
        aSession.invalidate ();
        return EChange.CHANGED;
      }
      catch (final IllegalStateException ex)
      {
        // session already invalidated
      }
    }
    return EChange.UNCHANGED;
  }
687022
private static void validateRELS(PID pid, String dsId, InputStream content)
            throws ValidationException {
        logger.debug("Validating " + dsId + " datastream");
        new RelsValidator().validate(pid, dsId, content);
        logger.debug(dsId + " datastream is valid");
    }