FIXME: flow control may or may not be an issue but old runtime handles it explicitly after accept.
16227
@Override
    public Object visit(Object context, ForVarDeclStatement statement, boolean strict) {
        Scope scope = (Scope) context;
        List<VariableDeclaration> decls = statement.getDeclarationList();
        for (VariableDeclaration each : decls) {
            each.accept(context, this, strict);
        }

        final Label startLabel = scope.getNewLabel();
        final Label doneLabel = scope.getNewLabel();

        scope.addInstruction(new LabelInstr(startLabel));
        // TEST
        scope.addInstruction(new BEQ((Operand) statement.getTest().accept(context, this, strict),
                BooleanLiteral.FALSE, doneLabel));

        // BODY
        statement.getBlock().accept(context, this, strict);

        // INCREMENT
        statement.getIncrement().accept(context, this, strict);

        scope.addInstruction(new Jump(startLabel));

        // END
        scope.addInstruction(new LabelInstr(doneLabel));

        return Undefined.UNDEFINED;
    }
1307620
@Nonnull
	public final LBiByteFunctionBuilder<R> withHandling(@Nonnull HandlingInstructions<RuntimeException, RuntimeException> handling) {
		Null.nonNullArg(handling, "handling");
		if (this.handling != null) {
			throw new UnsupportedOperationException("Handling is already set for this builder.");
		}
		this.handling = handling;
		return self();
	}
614912
private void getActiveFlowHelper(final ArrayList<ExecutableFlow> flows,
      final Collection<Pair<ExecutionReference, ExecutableFlow>> collection) {
    for (final Pair<ExecutionReference, ExecutableFlow> ref : collection) {
      flows.add(ref.getSecond());
    }
  }
10115
private synchronized void ensureIsRun() {
        if (!isRun) {
            isRun = true;
            try {
                result = executeProc(args);
                exception = null;
            } catch (ProcError e) {
                throw e.asRuntimeException();
            } catch (Throwable t) {
                exception = t;
                result = null;
            }
        }
    }
790188
@Override
    public Object accept(IEvent event, Object param) {
        return eventDispatcher().accept(event, param);
    }
1043916
private void handleRunAsync(RunAsync runAsync) {
		final long timeToRun = runAsync.getTimeNanos();
		final long delayNanos;

		if (timeToRun == 0 || (delayNanos = timeToRun - System.nanoTime()) <= 0) {
			// run immediately
			try {
				runAsync.getRunnable().run();
			} catch (Throwable t) {
				log.error("Caught exception while executing runnable in main thread.", t);
				ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
			}
		}
		else {
			// schedule for later. send a new message after the delay, which will then be immediately executed
			FiniteDuration delay = new FiniteDuration(delayNanos, TimeUnit.NANOSECONDS);
			RunAsync message = new RunAsync(runAsync.getRunnable(), timeToRun);

			final Object envelopedSelfMessage = envelopeSelfMessage(message);

			getContext().system().scheduler().scheduleOnce(delay, getSelf(), envelopedSelfMessage,
					getContext().dispatcher(), ActorRef.noSender());
		}
	}
3464
@FFDCIgnore({ IOException.class })
    private boolean acceptAndExecuteCommand() {
        boolean socketValid = false;
        try {
            //exceptions thrown by accept are assumed to mean the channel is no longer usable.
            SocketChannel sc = serverSocketChannel.accept();
            socketValid = true;
            if (sc != null) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "accepted socket", sc);
                }

                try {
                    String uuidAndCommand = read(sc);
                    ServerCommandID commandID = new ServerCommandID(uuidAndCommand);
                    String command = commandID.getOperation();

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        // Don't trace uuidAndCommand to avoid putting it in logs
                        // (not as secure as the workarea).
                        Tr.debug(tc, "read UUID and command", command);
                    }

                    // As a first level of security, require that the user has read access to the .sCommand file.
                    if (!commandID.validate()) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "invalid UUID", uuidAndCommand);
                        }
                    } else {
                        // As a second level of security, ensure that the client has write access to the workarea. We do
                        // this because by default, many umasks create world-readable files, which means everyone on a
                        // system can read the .sCommand file.
                        //
                        // Generate a unique filename in .sCommandAuth and request that the client create the named file.
                        String authID;
                        File authFile;
                        do {
                            authID = Integer.toString(nextCommandAuthID++);
                            authFile = new File(commandAuthDir, authID);
                        } while (authFile.exists());

                        // The server is going to create the file (to ensure server ownership bits are preserved),
                        authFile.createNewFile();

                        // write the authId: the client will delete the file to prove write-access
                        write(sc, authID);

                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "wrote authorization challenge", authID, authFile);
                        }

                        // Read the response: the caller should have deleted the file.
                        String authIDResponse = read(sc);
                        if (!authIDResponse.equals(authID) || authFile.exists()) {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(tc, "authorization failed");
                            }
                        } else {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(tc, "authorization succeeded");
                            }

                            sc = executeCommand(sc, command);
                        }
                    }
                } finally {
                    // Close the socket: one command per connection.
                    Utils.tryToClose(sc);
                }
            }
        } catch (IOException ex) {
            // FFDCIgnore of IOExceptions: some expected due to async close
        } catch (Throwable t) {
            // Don't allow an exception from a single command to
            // break the entire command listener.
        }
        return socketValid;
    }
9558
protected boolean processUnhandledAction( HttpServletRequest request, HttpServletResponse response, String uri )
        throws IOException, ServletException
    {
        //
        // First check to see if we're already in a forwarded fallback request.  If so, just bail.
        //
        PageFlowRequestWrapper rw = PageFlowRequestWrapper.get( request );
        if ( rw.getOriginalServletPath() != null ) return false;       
        
        SharedFlowController sharedFlowToTry = null;
        String uriBaseName = ServletUtils.getBaseName( uri );
        int firstDot = uriBaseName.indexOf( '.' );
        int lastDot = uriBaseName.lastIndexOf( '.' );
        
        if ( firstDot != -1 && firstDot != lastDot )
        {
            String sharedFlowName = uriBaseName.substring( 0, firstDot );
            
            try
            {
                RequestContext rc = new RequestContext( request, response );
                Map defaultSharedFlows = FlowControllerFactory.get( getServletContext() ).getDefaultSharedFlows( rc );
                
                if ( defaultSharedFlows != null )
                {
                    sharedFlowToTry = ( SharedFlowController ) defaultSharedFlows.get( sharedFlowName );
                    uriBaseName = uriBaseName.substring( firstDot + 1 );
                }
            }
            catch ( ClassNotFoundException e )
            {
                ServletUtils.throwServletException(e);
            }
            catch ( InstantiationException e )
            {
                ServletUtils.throwServletException(e);
            }
            catch ( IllegalAccessException e )
            {
                ServletUtils.throwServletException(e);
            }
        }
        else
        {
            sharedFlowToTry = FlowControllerFactory.getGlobalApp( request, response, getServletContext() );
        }
        
        //
        // If we couldn't find an appropriate module, try raising the action on the (deprecated) Global.app.
        //
        
        if ( sharedFlowToTry != null )
        {
            InternalStringBuilder sfActionURI = new InternalStringBuilder( sharedFlowToTry.getModulePath() );
            sfActionURI.append( '/' );
            sfActionURI.append( uriBaseName );
            rw.setOriginalServletPath( uri );
            ForwardRedirectHandler frh = _handlers.getForwardRedirectHandler();
            FlowControllerHandlerContext context = new FlowControllerHandlerContext( request, response, null );
            frh.forward( context, sfActionURI.toString() );
            return true;
        }
        
        return false;
    }
785698
@Override
  public void accept(final FastFuture<T> t) {

    active.add(t);

    if (active.size() > maxActive.getMaxActive()) {

      while (active.size() > maxActive.getReduceTo()) {

        final List<FastFuture> toRemove = active.stream()
          .filter(cf -> cf.isDone())
          .peek(this::handleExceptions)
          .collect(Collectors.toList());

        active.removeAll(toRemove);
        if (active.size() > maxActive.getReduceTo()) {
          final CompletableFuture promise = new CompletableFuture();
          FastFuture.xOf(active.size() - maxActive.getReduceTo(), () -> promise.complete(true), active.toArray(new FastFuture[0]));

          promise.join();
        }

      }
    }

  }
517887
@Fix(io.sarl.lang.validation.IssueCodes.INVALID_CAPACITY_TYPE)
	public void fixInvalidCapacityType(final Issue issue, IssueResolutionAcceptor acceptor) {
		CapacityReferenceRemoveModification.accept(this, issue, acceptor);
	}
1235453
def handle_wf_finalization(self):
        
        if ((not self.current.flow_enabled or (
            self.current.task_type.startswith('End') and not self.are_we_in_subprocess())) and
                    'token' in self.current.output):
            del self.current.output['token']
1300238
public void accept(final MethodVisitor mv) {
        mv.visitTryCatchBlock(start.getLabel(), end.getLabel(),
                handler == null ? null : handler.getLabel(), type);
        int n = visibleTypeAnnotations == null ? 0 : visibleTypeAnnotations
                .size();
        for (int i = 0; i < n; ++i) {
            TypeAnnotationNode an = visibleTypeAnnotations.get(i);
            an.accept(mv.visitTryCatchAnnotation(an.typeRef, an.typePath,
                    an.desc, true));
        }
        n = invisibleTypeAnnotations == null ? 0 : invisibleTypeAnnotations
                .size();
        for (int i = 0; i < n; ++i) {
            TypeAnnotationNode an = invisibleTypeAnnotations.get(i);
            an.accept(mv.visitTryCatchAnnotation(an.typeRef, an.typePath,
                    an.desc, false));
        }
    }
1025823
@Override
    public void accept(double value)
    {
        writeLock.lock();
        try
        {
            eliminate();
            endIncr();
            PrimitiveIterator.OfInt rev = modReverseIterator();
            int e = rev.nextInt();
            assign(e, value);
            while (rev.hasNext())
            {
                e = rev.nextInt();
                if (exceedsBounds(e, value))
                {
                    assign(e, value);
                }
                else
                {
                    break;
                }
            }
        }
        finally
        {
            writeLock.unlock();
        }
    }
421388
@Override
    public void afterCompletion(int status) {

        if (tc.isEntryEnabled()) {
            Tr.entry(this, tc, "afterCompletion");
        }

        if (tc.isDebugEnabled()) {
            Tr.debug(
                     tc,
                     "Using transaction wrapper@" + Integer.toHexString(this.hashCode()));
        }

        if (mcWrapper.isMCAborted()) {
            Tr.exit(tc, "Connection was aborted. Exiting afterCompletion.");
            return;
        }

        // When afterCompletionCode is called we need to reset the registeredForSync flag.
        registeredForSync = false;
        this.hasRollbackOccured = false;
        /*
         * Mark the transaction complete in the wrapper
         */
        // Do NOT catch runtime exections here.  Let them flow out of the component.
        mcWrapper.transactionComplete();

        if (tc.isDebugEnabled()) {
            if (mcWrapper.getHandleCount() != 0) {
                // Issue warning that Connections have not been closed by the end of the current UOW
                //  scope and will be closed by the CM.
                //            Tr.warning(this, tc,"HANDLE_NOT_CLOSED_J2CA0055");
                Tr.debug(this, tc, "Information:  handle not closed at end of UOW. Connection from pool " + mcWrapper.gConfigProps.getXpathId());
            }
        }

        // Do NOT catch the runtime exception which getConnectionManager might throw.
        // If this is thrown it is an internal bug and needs to be fixed.
        // Allow the rte to flow up to the container.
        boolean shareable = mcWrapper.getConnectionManager().shareable();

        //  - Simplified the following if/else construct taking advantage of the
        //             new releaseToPoolManger call on mcWrapper.
        //
        // If the connection is shareable, or it is non-shareable and the handleCount is
        // zero, then release it back to the poolManger, otherwise simply reset the
        // transaction related variables.
        //
        // Note: shareable connections are released at the end of transactions regardless of
        //  outstanding handles because we don't supports handled being associated to an active
        //  managedConnection outside of a sharing boundary.
        //
        //  if the MCWrapper is stale we will release the connection to the pool.
        //
        if ((shareable) || (!shareable && mcWrapper.getHandleCount() == 0) || mcWrapper.isStale()) {

            if (tc.isDebugEnabled()) {
                Tr.debug(this, tc,
                         "Releasing the connection to the pool. shareable = " + shareable + "  handleCount = " + mcWrapper.getHandleCount() + "  isStale = " + mcWrapper.isStale());
            }

            try {
                mcWrapper.releaseToPoolManager();
            } catch (Exception e) {
                // No need to rethrow this exception since nothing can be done about it,
                //  and the application has successfully finished its use of the connection.
                com.ibm.ws.ffdc.FFDCFilter.processException(
                                                            e,
                                                            "com.ibm.ejs.j2c.LocalTransactionWrapper.afterCompletion",
                                                            "711",
                                                            this);
                if (tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "afterCompletionCode for datasource " + mcWrapper.gConfigProps.cfName + ":  caught Exception", e);
                }
            }

        } // end ((shareable) || (!shareable && mcWrapper.getHandleCount() == 0))
        else {
            /*
             * The cleanup of the coordinator enlisted flag should only be done for non sharable connections, in
             * other cases, the coord is set to null in mcWrapper.releaseToPoolManager(). We only need to worry about this
             * if the handleCount is greater than 0 (in which case the cleanup will be done by the poolManager). Same
             * thing for the tranFailed flag in the MCWrapper.
             */
            mcWrapper.setUOWCoordinator(null);
            // Reset the serialReuseCount since it is only valid for the duration of
            // the LTC. Note that the release path above will also reset it via mcWrapper.cleanup().
            enlisted = false;
        }

        if (tc.isEntryEnabled()) {
            Tr.exit(this, tc, "afterCompletion");
        }
    }
1307946
@Override
  public boolean isFlowRunning(final int projectId, final String flowId) {
    boolean isRunning = false;
    try {
      isRunning = isFlowRunningHelper(projectId, flowId,
          this.executorLoader.fetchUnfinishedFlows().values());

    } catch (final ExecutorManagerException e) {
      logger.error(
          "Failed to check if the flow is running for project " + projectId + ", flow " + flowId,
          e);
    }
    return isRunning;
  }
3160
private void forwardToParameterServer(INDArrayMessage message) {
        try {
            incomingFlow.accept(message);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
865893
protected void updateInitialWindowsUpdateSize(int newSize) throws FlowControlException {
        // this method should only be called by the thread that came in on processNewFrame.
        // newSize should be treated as an unsigned 32-bit int

        if (myID == 0) {
            // the control stream doesn't care about initial window size updates
            return;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "updateInitialWindowsUpdateSize entry: stream {0} newSize: {1}", myID, newSize);
        }

        long diff = newSize - streamWindowUpdateWriteInitialSize;

        streamWindowUpdateWriteInitialSize = newSize;
        streamWindowUpdateWriteLimit += diff;

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "streamWindowUpdateWriteInitialSize updated to: " + streamWindowUpdateWriteInitialSize);
            Tr.debug(tc, "streamWindowUpdateWriteLimit updated to: " + streamWindowUpdateWriteLimit);
        }

        // if any data frames were waiting for a window update, write them out now
        flushDataWaitingForWindowUpdate();
    }