Applies action to a randomly picked RouterStub that's connected
@param action
507583
public void forAny(Consumer<RouterStub> action) {
        while(!stubs.isEmpty()) {
            RouterStub stub=Util.pickRandomElement(stubs);
            if(stub != null && stub.isConnected()) {
                action.accept(stub);
                return;
            }
        }
    }
821589
public function setAction($action)
    {
        foreach ($this->routes as $route)
            $route->setAction($action);
        return $this;
    }
7297
private function _routeCron($src, $controller, $action) {
        $this->request->name = '-' . $src . '_' . $controller . '_' . $action;
        $this->request->src = $src;
        $this->request->controller = $controller;
        $this->request->action = $action;
        $this->request->auth = new Auth($this->request->src);
        $this->_route = true;
    }
797621
public void forEach(final IntConsumer action) {
		requireNonNull(action);

		final int size = _size;
		for (int i = 0; i < size; ++i) {
			action.accept(_data[i]);
		}
	}
748841
protected function processAction(DOMNode $action)
    {
        $actionName = substr($action->nodeName, strlen($action->lookupPrefix(self::NS)) + 1);
        $methodName = 'action' . $actionName;
        if (method_exists($this, $methodName))
        {
            $this->$methodName($action);
        }
    }
1034073
private Action handleAddUpdateActionStatus(final JpaActionStatus actionStatus, final JpaAction action) {

        String controllerId = null;
        LOG.debug("handleAddUpdateActionStatus for action {}", action.getId());

        // information status entry - check for a potential DOS attack
        assertActionStatusQuota(action);
        assertActionStatusMessageQuota(actionStatus);

        switch (actionStatus.getStatus()) {
        case ERROR:
            final JpaTarget target = (JpaTarget) action.getTarget();
            target.setUpdateStatus(TargetUpdateStatus.ERROR);
            handleErrorOnAction(action, target);
            break;
        case FINISHED:
            controllerId = handleFinishedAndStoreInTargetStatus(action);
            break;
        case DOWNLOADED:
            controllerId = handleDownloadedActionStatus(action);
            break;
        default:
            break;
        }

        actionStatus.setAction(action);
        actionStatusRepository.save(actionStatus);
        final Action savedAction = actionRepository.save(action);

        if (controllerId != null) {
            requestControllerAttributes(controllerId);
        }

        return savedAction;
    }
211278
public function patch($uri, $action)
    {
        $uri = $this->buildUri($uri);

        return $this->addResponseType(Route::patch($uri, $action));
    }
1284770
public final void batchUpdateWidget(final Runnable action) {
        _batchUpdateCounter++;
        try {
            action.run();
        } catch (final RuntimeException e) {
            logger.error("Exception occurred in widget batch update, fireValueChanged() will not be invoked", e);
            throw e;
        } finally {
            _batchUpdateCounter--;
        }
        if (_batchUpdateCounter == 0) {
            onBatchFinished();
        }
    }
1363924
@SuppressWarnings({"ConstantConditions","deprecation"})
    @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
    public void addAction(@Nonnull Action a) {
        if(a==null) {
            throw new IllegalArgumentException("Action must be non-null");
        }
        getActions().add(a);
    }
951185
public void setAction(String action) throws ApplicationException {
	action = action.toLowerCase().trim();
	if (action.equals("get")) this.action = GET;
	else if (action.equals("put")) this.action = PUT;

	else if (action.equals("cache")) this.action = CACHE;
	else if (action.equals("clientcache")) this.action = CACHE_CLIENT;
	else if (action.equals("servercache")) this.action = CACHE_SERVER;
	else if (action.equals("flush")) this.action = FLUSH;
	else if (action.equals("optimal")) this.action = CACHE;

	else if (action.equals("client-cache")) this.action = CACHE_CLIENT;
	else if (action.equals("client_cache")) this.action = CACHE_CLIENT;

	else if (action.equals("server-cache")) this.action = CACHE_SERVER;
	else if (action.equals("server_cache")) this.action = CACHE_SERVER;

	else if (action.equals("content")) this.action = CONTENT;
	else if (action.equals("content_cache")) this.action = CONTENT;
	else if (action.equals("contentcache")) this.action = CONTENT;
	else if (action.equals("content-cache")) this.action = CONTENT;
	else throw new ApplicationException("invalid value for attribute action for tag cache [" + action + "], "
		+ "valid actions are [get,put,cache, clientcache, servercache, flush, optimal, contentcache]");

	// get: get an object from the cache.
	// put: Add an object to the cache.

    }
1147188
private void checkAndCancelExpiredAction(final Action action) {
        if (action != null && action.hasMaintenanceSchedule() && action.isMaintenanceScheduleLapsed()) {
            try {
                controllerManagement.cancelAction(action.getId());
            } catch (final CancelActionNotAllowedException e) {
                LOG.info("Cancel action not allowed exception :{}", e);
            }
        }
    }
930149
public function getActionRoute($action = null)
    {
        if (null === $action) {
            $action = $this->getEvent()
                ->getRouteMatch()
                ->getParam('action');
        }

        return $this->getRouteName().'/'.$action;
    }
630102
public void act(ActionExec action, List<ActionExec> feedback) {
        if (!isRunning())
            return;
        if (this.getSimulation() == null)
            return;

        boolean result = false;

        Structure actionStructure = action.getActionTerm();
        String actionID = actionStructure.getFunctor();

        try {
            if (this.actions.containsKey(actionID)) {

                Constructor<? extends JasonShanksAgentAction> c = this.actions
                        .get(actionID).getConstructor(
                                new Class[] { String.class, Steppable.class });

                JasonShanksAgentAction shanksAction = c.newInstance(
                        this.getID(), this, this.getLogger());

                result = shanksAction.executeAction(this.getSimulation(), this,
                        actionStructure.getTerms());
            } else {
                throw new UnknownShanksAgentActionException(actionID,
                        this.getID());
            }

        } catch (UnknownShanksAgentActionException e) {
            logger.severe("Action was not executed -> " + e.getMessage());
            e.printStackTrace();
        } catch (InstantiationException e) {
            logger.severe("InstantiationException" + e.getMessage());
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            logger.severe("IllegalAccessException" + e.getMessage());
            e.printStackTrace();
        } catch (SecurityException e) {
            logger.severe("SecurityException" + e.getMessage());
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            logger.severe("NoSuchMethodException" + e.getMessage());
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            logger.severe("IllegalArgumentException" + e.getMessage());
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            logger.severe("InvocationTargetException" + e.getMessage());
            e.printStackTrace();
        }

        action.setResult(result);
        this.getTS().getC().addFeedbackAction(action);
    }
314726
@Override
    public void setAction(final Runnable action) {
        super.setAction(new Runnable() {
            @Override
            public void run() {
                if (!isRunning) {
                    thread = new Thread(wrappedAction(action), "wunderboss-daemon-thread[" + name + "]");
                    thread.start();
                    isRunning = true;
                }
            }
        });
    }
853620
def _begin_operation_action(self, action):
        

        conn_key = action.data['id']
        callback = action.data['callback']

        if self._get_connection_state(conn_key) != self.Idle:
            callback(conn_key, self.id, False, 'Cannot start operation, connection is not idle')
            return

        data = self._get_connection(conn_key)
        data['state'] = self.InProgress
        data['microstate'] = action.data['operation_name']
        data['action'] = action
138617
protected void fireAction(ActionListener action) {
        int      modifiers    = 0;
        AWTEvent currentEvent = EventQueue.getCurrentEvent();

        if (currentEvent instanceof InputEvent) {
            modifiers = ((InputEvent) currentEvent).getModifiers();
        } else if (currentEvent instanceof ActionEvent) {
            modifiers = ((ActionEvent) currentEvent).getModifiers();
        }

        ActionEvent e = new ActionEvent(getComponent(), ActionEvent.ACTION_PERFORMED, getComponent().getText(),
                                        EventQueue.getMostRecentEventTime(), modifiers);

        action.actionPerformed(e);
    }
617225
public void setHandler(String contextId, Runnable action) {

        if (contextId != null) {
            m_createFunctions.put(contextId, action);
        }
    }