Called to transition {@code passThrough} to {@code true}. This method is not safe to be called
multiple times; the caller must ensure it will only be called once, ever. {@code this} lock
should not be held when calling this method.
183279
private void drainPendingCalls() {
    assert realStream != null;
    assert !passThrough;
    List<Runnable> toRun = new ArrayList<>();
    DelayedStreamListener delayedListener = null;
    while (true) {
      synchronized (this) {
        if (pendingCalls.isEmpty()) {
          pendingCalls = null;
          passThrough = true;
          delayedListener = this.delayedListener;
          break;
        }
        // Since there were pendingCalls, we need to process them. To maintain ordering we can't set
        // passThrough=true until we run all pendingCalls, but new Runnables may be added after we
        // drop the lock. So we will have to re-check pendingCalls.
        List<Runnable> tmp = toRun;
        toRun = pendingCalls;
        pendingCalls = tmp;
      }
      for (Runnable runnable : toRun) {
        // Must not call transport while lock is held to prevent deadlocks.
        // TODO(ejona): exception handling
        runnable.run();
      }
      toRun.clear();
    }
    if (delayedListener != null) {
      delayedListener.drainPendingCallbacks();
    }
  }
578084
public static <S, I, T, D> boolean breadthFirst(TransitionSystem<S, ? super I, T> ts,
                                                    int limit,
                                                    Collection<? extends I> inputs,
                                                    TSTraversalVisitor<S, I, T, D> vis) {
        Deque<BFSRecord<S, D>> bfsQueue = new ArrayDeque<>();

        // setting the following to false means that the traversal had to be aborted
        // due to reaching the limit
        boolean complete = true;
        int stateCount = 0;

        Holder<D> dataHolder = new Holder<>();

        for (S initS : ts.getInitialStates()) {
            dataHolder.value = null;
            TSTraversalAction act = vis.processInitial(initS, dataHolder);
            switch (act) {
                case ABORT_TRAVERSAL:
                    return complete;
                case EXPLORE:
                    if (stateCount != limit) {
                        bfsQueue.offer(new BFSRecord<>(initS, dataHolder.value));
                        stateCount++;
                    } else {
                        complete = false;
                    }
                    break;
                default: // case ABORT_INPUT: case ABORT_STATE: case IGNORE:
            }
        }

        while (!bfsQueue.isEmpty()) {
            BFSRecord<S, D> current = bfsQueue.poll();

            S state = current.state;
            D data = current.data;

            if (!vis.startExploration(state, data)) {
                continue;
            }

            inputs_loop:
            for (I input : inputs) {
                Collection<T> transitions = ts.getTransitions(state, input);

                for (T trans : transitions) {
                    S succ = ts.getSuccessor(trans);

                    dataHolder.value = null;
                    TSTraversalAction act = vis.processTransition(state, data, input, trans, succ, dataHolder);

                    switch (act) {
                        case ABORT_INPUT:
                            continue inputs_loop;
                        case ABORT_STATE:
                            break inputs_loop;
                        case ABORT_TRAVERSAL:
                            return complete;
                        case EXPLORE:
                            if (stateCount != limit) {
                                bfsQueue.offer(new BFSRecord<>(succ, dataHolder.value));
                                stateCount++;
                            } else {
                                complete = false;
                            }
                            break;
                        case IGNORE:
                            break;
                        default:
                            throw new IllegalStateException("Unknown action " + act);
                    }
                }
            }
        }

        return complete;
    }
858344
public boolean handleNext()
    {
        AJP13RequestPacket packet=null;
        HttpRequest request=getRequest();
        HttpResponse response=getResponse();
        HttpContext context=null;
        boolean gotRequest=false;
        _persistent=true;
        _keepAlive=true;

        try
        {
            try
            {
                packet=null;
                packet=_ajpIn.nextPacket();
                if (packet==null)
                    return false;
                if (packet.getDataSize()==0)
                    return true;
            }
            catch (IOException e)
            {
                LogSupport.ignore(log,e);
                return false;
            }

            int type=packet.getByte();
            if (log.isDebugEnabled())
                log.debug("AJP13 type="+type+" size="+packet.unconsumedData());

            switch (type)
            {
                case AJP13Packet.__FORWARD_REQUEST:
                    request.setTimeStamp(System.currentTimeMillis());

                    request.setState(HttpMessage.__MSG_EDITABLE);
                    request.setMethod(packet.getMethod());
                    request.setVersion(packet.getString());
		    String version=packet.getString();
		    try
		    {
			request.setVersion(version);
		    }
		    catch(Exception e)
		    {
			log.warn("Bad version"+version,e);
			log.warn(packet.toString());
		    }

                    String path=packet.getString();
                    int sc=path.lastIndexOf(";");
                    if (sc<0)
                        request.setPath(URI.encodePath(path));
                    else
                        request.setPath(URI.encodePath(path.substring(0,sc))+path.substring(sc));

                    _remoteAddr=packet.getString();
                    _remoteHost=packet.getString();
                    _serverName=packet.getString();
                    _serverPort=packet.getInt();
                    _isSSL=packet.getBoolean();

                    // Check keep alive
                    _keepAlive=request.getDotVersion()>=1;

                    // Headers
                    int h=packet.getInt();
                    for (int i=0; i<h; i++)
                    {
                        String hdr=packet.getHeader();
                        String val=packet.getString();
                        request.addField(hdr,val);
                        if (!_keepAlive&&hdr.equalsIgnoreCase(HttpFields.__Connection)&&val.equalsIgnoreCase(HttpFields.__KeepAlive))
                            _keepAlive=true;
                    }

                    // Handler other attributes
                    byte attr=packet.getByte();
                    while ((0xFF&attr)!=0xFF)
                    {
                        String value=(attr==11)?null:packet.getString();
                        switch (attr)
                        {
                            case 11: // key size
                                request.setAttribute("javax.servlet.request.key_size",new Integer(packet.getInt()));
                                break;
                            case 10: // request attribute
                                request.setAttribute(value,packet.getString());
                                break;
                            case 9: // SSL session
                                request.setAttribute("javax.servlet.request.ssl_session",value);
                                break;
                            case 8: // SSL cipher
                                request.setAttribute("javax.servlet.request.cipher_suite",value);
                                break;
                            case 7: // SSL cert
                                // request.setAttribute("javax.servlet.request.X509Certificate",value);
                                CertificateFactory cf=CertificateFactory.getInstance("X.509");
                                InputStream certstream=new ByteArrayInputStream(value.getBytes());
                                X509Certificate cert=(X509Certificate)cf.generateCertificate(certstream);
                                X509Certificate certs[]=
                                { cert };
                                request.setAttribute("javax.servlet.request.X509Certificate",certs);
                                break;
                            case 6: // JVM Route
                                request.setAttribute("org.browsermob.proxy.jetty.http.ajp.JVMRoute",value);
                                break;
                            case 5: // Query String
                                request.setQuery(value);
                                break;
                            case 4: // AuthType
                                request.setAuthType(value);
                                break;
                            case 3: // Remote User
                                request.setAuthUser(value);
                                break;

                            case 2: // servlet path not implemented
                            case 1: // _context not implemented
                            default:
                                log.warn("Unknown attr: "+attr+"="+value);
                        }

                        attr=packet.getByte();
                    }

                    _listener.customizeRequest(this,request);

                    gotRequest=true;
                    statsRequestStart();
                    request.setState(HttpMessage.__MSG_RECEIVED);

                    // Complete response
                    if (request.getContentLength()==0&&request.getField(HttpFields.__TransferEncoding)==null)
                        _ajpIn.close();

                    // Prepare response
                    response.setState(HttpMessage.__MSG_EDITABLE);
                    response.setVersion(HttpMessage.__HTTP_1_1);
                    response.setDateField(HttpFields.__Date,_request.getTimeStamp());
                    if (!Version.isParanoid())
                        response.setField(HttpFields.__Server,Version.getDetail());

                    // Service request
                    if (log.isDebugEnabled())
                        log.debug("REQUEST:\n"+request);
                    context=service(request,response);
                    if (log.isDebugEnabled())
                        log.debug("RESPONSE:\n"+response);

                    break;

                default:
                    if (log.isDebugEnabled())
                        log.debug("Ignored: "+packet);
                    _persistent=false;
            }

        }
        catch (SocketException e)
        {
            LogSupport.ignore(log,e);
            _persistent=false;
        }
        catch (Exception e)
        {
            log.warn(LogSupport.EXCEPTION,e);
            _persistent=false;
            try
            {
                if (gotRequest)
                    _ajpOut.close();
            }
            catch (IOException e2)
            {
                LogSupport.ignore(log,e2);
            }
        }
        finally
        {
            // abort if nothing received.
            if (packet==null||!gotRequest)
                return false;

            // flush and end the output
            try
            {
                // Consume unread input.
                // while(_ajpIn.skip(4096)>0 || _ajpIn.read()>=0);

                // end response
                getOutputStream().close();
                if (!_persistent)
                    _ajpOut.end();

                // Close the outout
                _ajpOut.close();

                // reset streams
                getOutputStream().resetStream();
                getOutputStream().addObserver(this);
                getInputStream().resetStream();
                _ajpIn.resetStream();
                _ajpOut.resetStream();
            }
            catch (Exception e)
            {
                log.debug(LogSupport.EXCEPTION,e);
                _persistent=false;
            }
            finally
            {
                statsRequestEnd();
                if (context!=null)
                    context.log(request,response,-1);
            }
        }
        return _persistent;
    }
123966
@Override
    public boolean passes(final String scope) {
        if (skipTestScope && SCOPE_TEST.equals(scope)) {
            return true;
        }
        if (skipProvidedScope && SCOPE_PROVIDED.equals(scope)) {
            return true;
        }
        if (skipSystemScope && SCOPE_SYSTEM.equals(scope)) {
            return true;
        }
        if (skipRuntimeScope && SCOPE_RUNTIME.equals(scope)) {
            return true;
        }
        if (skipRuntimeScope && skipSystemScope && SCOPE_COMPILE_PLUS_RUNTIME.equals(scope)) {
            return true;
        }
        return false;
    }
262081
public void reachabilityChange(boolean reachable)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this,tc, "reachabilityChange", Boolean.valueOf(reachable));
    Object[] clonedConsumerPoints = null;
    synchronized (consumerPoints)
    {      
      // If we went from reachable to not reachable - clone the consumer points
      if (_currentReachability && !reachable)
      {
        // we clone the list before notifying the exception, since the CP's may call methods on the CD in the
        // context of the notification, and don't want a deadlock
        clonedConsumerPoints = consumerPoints.toArray();
      }
      _currentReachability = reachable;
    }
    if (clonedConsumerPoints != null)
    {
      // unreachable. throw exception to ConsumerPoints
      SIResourceException e = new SIResourceException(
        nls.getFormattedMessage("ANYCAST_STREAM_UNAVAILABLE_CWSIP0471",
                                new Object[]{getDestName(), SIMPUtils.getMENameFromUuid(getLocalisationUuid().toString())},
                                null));
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.exception(tc, e);

      for (int i=0; i<clonedConsumerPoints.length; i++)
      {
        DispatchableKey ck = (DispatchableKey) clonedConsumerPoints[i];
        
        // Only close non gathering consumer points - the 
        
        ck.getConsumerPoint().implicitClose(null, e, _aih.getLocalisationUuid() );
      }
    }
    if (TraceComponent.isAnyTracingEnabled() &&  tc.isEntryEnabled()) SibTr.exit(tc, "reachabilityChange");
  }
737735
protected int transition(int current, char c)
    {
        int b = current;
        int p;

        p = b + c + 1;
        if (b == check[p])
            b = base[p];
        else
            return -1;

        p = b;
        return p;
    }
851578
function ZPassThrough(options) {
	if(options) {
		if(options.objectMode) {
			options.readableObjectMode = true;
			options.writableObjectMode = true;
		}
		if(options.readableObjectMode && options.writableObjectMode) {
			options.objectMode = true;
		}
	}
	PassThrough.call(this, options);
	// note: exclamation marks are used to convert to booleans
	if(options && !options.objectMode && (!options.readableObjectMode) !== (!options.writableObjectMode)) {
		this._writableState.objectMode = !!options.writableObjectMode;
		this._readableState.objectMode = !!options.readableObjectMode;
	}
	if(options && options.readableObjectMode) {
		this._readableState.highWaterMark = 16;
	}
	if(options && options.writableObjectMode) {
		this._writableState.highWaterMark = 16;
	}
	streamMixins.call(this, PassThrough.prototype, options);
	readableMixins.call(this, options);
	writableMixins.call(this, options);
}
1177795
public boolean onChangePassword()
    {
        Record record = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, this);
        this.removeRecord(record);
        BasePanel parentScreen = this.getParentScreen();
        ScreenLocation itsLocation = this.getScreenLocation();
        this.finalizeThisScreen();  // Validate current control, update record, get ready to close screen.
        Map<String,Object> properties = null;
        this.free();
        int docMode = record.commandToDocType(UserInfoModel.PASSWORD_CHANGE_SCREEN);
        record.makeScreen(itsLocation, parentScreen, docMode, properties);
        return true;   // Should always be successful
    }
1369443
public static boolean runExample(final Callable<Boolean> example) {
    boolean result;
    try {
      result = example.call();
    } catch (Exception e) {
      LOG.error("Exception running test: " + example, e);
      result = false;
    }
    CliUtils.printPassInfo(result);
    return result;
  }
257638
public PassthroughResources passthroughResources() {
        if (passthrough.get() == null) {
            passthrough.compareAndSet(null, new PassthroughResourcesImpl(this));
        }
        return passthrough.get();
    }
537262
public void dereferenceControllable()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "dereferenceControllable");
    _sourceStream = null;
    _sourceStreamSet = null;
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "dereferenceControllable");
  }
1328860
@Override
  public void process(Node externs, Node root) {
    progress = 0.0;
    progressStep = 0.0;
    if (progressRange != null) {
      progressStep = (progressRange.maxValue - progressRange.initialValue)
          / passes.size();
      progress = progressRange.initialValue;
    }

    // When looking at this code, one can mistakenly think that the instance of
    // PhaseOptimizer keeps all compiler passes live. This would be undesirable. A pass can
    // create large data structures that are only useful to the pass, and we shouldn't
    // retain them until the end of the compilation. But if you look at
    // NamedPass#process, the actual pass is created and immediately executed, and no
    // reference to it is retained in PhaseOptimizer:
    //   factory.create(compiler).process(externs, root);
    for (CompilerPass pass : passes) {
      if (Thread.interrupted()) {
        throw new RuntimeException(new InterruptedException());
      }
      pass.process(externs, root);
      if (hasHaltingErrors()) {
        return;
      }
    }
  }
432479
boolean handleStep(ListIterator<Step<?, ?>> stepIterator, MutableInt pathCount) {
        Step<?, ?> step = stepIterator.next();
        removeTinkerPopLabels(step);
        if (step instanceof GraphStep) {
            doFirst(stepIterator, step, pathCount);
        } else if (this.sqlgStep == null) {
            boolean keepGoing = doFirst(stepIterator, step, pathCount);
            stepIterator.previous();
            return keepGoing;
        } else {
            if (step instanceof VertexStep || step instanceof EdgeVertexStep || step instanceof EdgeOtherVertexStep) {
                handleVertexStep(stepIterator, (AbstractStep<?, ?>) step, pathCount);
            } else if (step instanceof RepeatStep) {
                if (!unoptimizableRepeatStep()) {
                    handleRepeatStep((RepeatStep<?>) step, pathCount);
                } else {
                    this.currentReplacedStep.addLabel((pathCount) + BaseStrategy.PATH_LABEL_SUFFIX + BaseStrategy.SQLG_PATH_FAKE_LABEL);
                    return false;
                }
            } else if (step instanceof OptionalStep) {
                if (!unoptimizableOptionalStep((OptionalStep<?>) step)) {
                    this.optionalStepStack.clear();
                    handleOptionalStep(1, (OptionalStep<?>) step, this.traversal, pathCount);
                    this.optionalStepStack.clear();
                    //after choose steps the optimization starts over in VertexStrategy
                    this.reset = true;
                } else {
                    return false;
                }
            } else if (step instanceof ChooseStep) {
                if (!unoptimizableChooseStep((ChooseStep<?, ?, ?>) step)) {
                    this.chooseStepStack.clear();
                    handleChooseStep(1, (ChooseStep<?, ?, ?>) step, this.traversal, pathCount);
                    this.chooseStepStack.clear();
                    //after choose steps the optimization starts over
                    this.reset = true;
                } else {
                    return false;
                }
            } else if (step instanceof OrderGlobalStep) {
                stepIterator.previous();
                handleOrderGlobalSteps(stepIterator, pathCount);
                handleRangeGlobalSteps(stepIterator, pathCount);
            } else if (step instanceof RangeGlobalStep) {
                handleRangeGlobalSteps(stepIterator, pathCount);
            } else if (step instanceof SelectStep || (step instanceof SelectOneStep)) {
                handleOrderGlobalSteps(stepIterator, pathCount);
                handleRangeGlobalSteps(stepIterator, pathCount);
                //select step can not be followed by a PropertyStep
                if (step instanceof SelectOneStep) {
                    SelectOneStep selectOneStep = (SelectOneStep) step;
                    String key = (String) selectOneStep.getScopeKeys().iterator().next();
                    if (stepIterator.hasNext()) {
                        Step<?, ?> next = stepIterator.next();
                        if (next instanceof PropertiesStep) {
                            //get the step for the label
                            Optional<ReplacedStep<?, ?>> labeledReplacedStep = this.sqlgStep.getReplacedSteps().stream().filter(
                                    r -> {
                                        //Take the first
                                        if (r.hasLabels()) {
                                            String label = r.getLabels().iterator().next();
                                            String stepLabel = SqlgUtil.originalLabel(label);
                                            return stepLabel.equals(key);
                                        } else {
                                            return false;
                                        }
                                    }
                            ).findAny();
                            Preconditions.checkState(labeledReplacedStep.isPresent());
                            ReplacedStep<?, ?> replacedStep = labeledReplacedStep.get();
                            handlePropertiesStep(replacedStep, next);
                            return true;
                        } else {
                            stepIterator.previous();
                            return false;
                        }
                    }
                }
//                return !stepIterator.hasNext() || !(stepIterator.next() instanceof SelectOneStep);
            } else if (step instanceof DropStep && (!this.sqlgGraph.getSqlDialect().isMariaDb())) {

                Traversal.Admin<?, ?> root = TraversalHelper.getRootTraversal(this.traversal);
                final Optional<EventStrategy> eventStrategyOptional = root.getStrategies().getStrategy(EventStrategy.class);
                if (eventStrategyOptional.isPresent()) {
                    //Do nothing, it will go via the SqlgDropStepBarrier.
                } else {
                    //MariaDB does not support target and source together.
                    //Table 'E_ab' is specified twice, both as a target for 'DELETE' and as a separate source for data
                    //This has been fixed in 10.3.1, waiting for it to land in the repo.
                    handleDropStep();
                }
                return false;
            } else if (step instanceof DropStep && this.sqlgGraph.getSqlDialect().isMariaDb()) {
                return false;
            } else if (step instanceof PropertiesStep) {
                return handlePropertiesStep(this.currentReplacedStep, step);
            } else if (step instanceof PropertyMapStep) {
                return handlePropertyMapStep(step);
            } else {
                throw new IllegalStateException("Unhandled step " + step.getClass().getName());
            }
        }
        return true;
    }
1341003
boolean propagate(AmbiguatedFunctionSummary callee, AmbiguatedFunctionSummary caller) {
      int initialCallerFlags = caller.bitmask;

      if (callerIsAlias) {
        caller.setMask(callee.bitmask);
        return caller.bitmask != initialCallerFlags;
      }

      if (callee.mutatesGlobalState()) {
        // If the callee modifies global state then so does that caller.
        caller.setMutatesGlobalState();
      }
      if (callee.functionThrows()) {
        // If the callee throws an exception then so does the caller.
        caller.setFunctionThrows();
      }
      if (callee.mutatesArguments() && !allArgsUnescapedLocal) {
        // If the callee mutates its input arguments and the arguments escape the caller then it has
        // unbounded side effects.
        caller.setMutatesGlobalState();
      }
      if (callee.mutatesThis()) {
        if (invocation.isNew()) {
          // NEWing a constructor provide a unescaped "this" making side-effects impossible.
        } else if (calleeThisEqualsCallerThis) {
          caller.setMutatesThis();
        } else {
          caller.setMutatesGlobalState();
        }
      }

      return caller.bitmask != initialCallerFlags;
    }
1024745
@Override
    boolean tryObtainPermission() {
        // Thread-safe
        if (clock.instant().isAfter(retryAfterWaitDuration)) {
            stateMachine.transitionToHalfOpenState();
            return true;
        }
        circuitBreakerMetrics.onCallNotPermitted();
        return false;
    }
1059504
boolean isDeadEnd()
    {
        if (isAccepting())
        {
            return false;
        }
        for (Transition<DFAState<T>> next : transitions.values())
        {
            if (next.getTo() != this)
            {
                return false;
            }
        }
        return true;
    }
337534
@Override
	public void passed(final PassedRoute passed) {
		int childSize = getChildSize();
		for (int i = 0; i < childSize; ++i) {
			getChild(i).passed(passed);
		}
		super.passed(passed);
	}