Examples of AgentInstance


Examples of com.espertech.esper.core.context.mgr.AgentInstance

            return;
        }

        // there is a single callback and a single context, if they match we are done
        if (agentInstances.size() == 1 && callbacks.size() == 1) {
            AgentInstance agentInstance = agentInstances.get(0);
            if (agentInstance.getAgentInstanceContext().getStatementId().equals(callbacks.getFirst().getStatementId())) {
                process(agentInstance, servicesContext, callbacks, theEvent);
            }
            return;
        }

        // use the right sorted/unsorted Map keyed by AgentInstance to sort
        boolean isPrioritized = servicesContext.getConfigSnapshot().getEngineDefaults().getExecution().isPrioritized();
        Map<AgentInstance, Object> stmtCallbacks;
        if (!isPrioritized) {
            stmtCallbacks = new HashMap<AgentInstance, Object>();
        }
        else {
            stmtCallbacks = new TreeMap<AgentInstance, Object>(AgentInstanceComparator.INSTANCE);
        }

        // process all callbacks
        for (FilterHandle filterHandle : callbacks)
        {
            // determine if this filter entry applies to any of the affected agent instances
            String statementId = filterHandle.getStatementId();
            AgentInstance agentInstanceFound = null;
            for (AgentInstance agentInstance : agentInstances) {
                if (agentInstance.getAgentInstanceContext().getStatementId().equals(statementId)) {
                    agentInstanceFound = agentInstance;
                    break;
                }
            }
            if (agentInstanceFound == null) {   // when the callback is for some other stmt
                continue;
            }

            EPStatementHandleCallback handleCallback = (EPStatementHandleCallback) filterHandle;
            EPStatementAgentInstanceHandle handle = handleCallback.getAgentInstanceHandle();

            // Self-joins require that the internal dispatch happens after all streams are evaluated.
            // Priority or preemptive settings also require special ordering.
            if (handle.isCanSelfJoin() || isPrioritized)
            {
                Object stmtCallback = stmtCallbacks.get(agentInstanceFound);
                if (stmtCallback == null) {
                    stmtCallbacks.put(agentInstanceFound, handleCallback);
                }
                else if (stmtCallback instanceof ArrayDeque) {
                    ArrayDeque<EPStatementHandleCallback> q = (ArrayDeque<EPStatementHandleCallback>) stmtCallback;
                    q.add(handleCallback);
                }
                else {
                    ArrayDeque<EPStatementHandleCallback> q = new ArrayDeque<EPStatementHandleCallback>(4);
                    q.add((EPStatementHandleCallback) stmtCallback);
                    q.add(handleCallback);
                    stmtCallbacks.put(agentInstanceFound, q);
                }
                continue;
            }

            // no need to be sorted, process
            process(agentInstanceFound, servicesContext, Collections.<FilterHandle>singletonList(handleCallback), theEvent);
        }

        if (stmtCallbacks.isEmpty()) {
            return;
        }

        // Process self-join or sorted prioritized callbacks
        for (Map.Entry<AgentInstance, Object> entry : stmtCallbacks.entrySet())
        {
            AgentInstance agentInstance = entry.getKey();
            Object callbackList = entry.getValue();
            if (callbackList instanceof ArrayDeque) {
                process(agentInstance, servicesContext, (Collection<FilterHandle>) callbackList, theEvent);
            }
            else {
                process(agentInstance, servicesContext, Collections.<FilterHandle>singletonList((FilterHandle) callbackList), theEvent);
            }
            if (agentInstance.getAgentInstanceContext().getEpStatementAgentInstanceHandle().isPreemptive()) {
                return;
            }
        }
    }
View Full Code Here

Examples of com.espertech.esper.core.context.mgr.AgentInstance

            return;
        }

        // there is a single callback and a single context, if they match we are done
        if (agentInstances.size() == 1 && callbacks.size() == 1) {
            AgentInstance agentInstance = agentInstances.get(0);
            if (agentInstance.getAgentInstanceContext().getStatementId().equals(callbacks.getFirst().getStatementId())) {
                process(agentInstance, servicesContext, callbacks, theEvent);
            }
            return;
        }

        // use the right sorted/unsorted Map keyed by AgentInstance to sort
        boolean isPrioritized = servicesContext.getConfigSnapshot().getEngineDefaults().getExecution().isPrioritized();
        Map<AgentInstance, Object> stmtCallbacks;
        if (!isPrioritized) {
            stmtCallbacks = new HashMap<AgentInstance, Object>();
        }
        else {
            stmtCallbacks = new TreeMap<AgentInstance, Object>(AgentInstanceComparator.INSTANCE);
        }

        // process all callbacks
        for (FilterHandle filterHandle : callbacks)
        {
            // determine if this filter entry applies to any of the affected agent instances
            String statementId = filterHandle.getStatementId();
            AgentInstance agentInstanceFound = null;
            for (AgentInstance agentInstance : agentInstances) {
                if (agentInstance.getAgentInstanceContext().getStatementId().equals(statementId)) {
                    agentInstanceFound = agentInstance;
                    break;
                }
            }
            if (agentInstanceFound == null) {   // when the callback is for some other stmt
                continue;
            }

            EPStatementHandleCallback handleCallback = (EPStatementHandleCallback) filterHandle;
            EPStatementAgentInstanceHandle handle = handleCallback.getAgentInstanceHandle();

            // Self-joins require that the internal dispatch happens after all streams are evaluated.
            // Priority or preemptive settings also require special ordering.
            if (handle.isCanSelfJoin() || isPrioritized)
            {
                Object stmtCallback = stmtCallbacks.get(agentInstanceFound);
                if (stmtCallback == null) {
                    stmtCallbacks.put(agentInstanceFound, handleCallback);
                }
                else if (stmtCallback instanceof ArrayDeque) {
                    ArrayDeque<EPStatementHandleCallback> q = (ArrayDeque<EPStatementHandleCallback>) stmtCallback;
                    q.add(handleCallback);
                }
                else {
                    ArrayDeque<EPStatementHandleCallback> q = new ArrayDeque<EPStatementHandleCallback>(4);
                    q.add((EPStatementHandleCallback) stmtCallback);
                    q.add(handleCallback);
                    stmtCallbacks.put(agentInstanceFound, q);
                }
                continue;
            }

            // no need to be sorted, process
            process(agentInstanceFound, servicesContext, Collections.<FilterHandle>singletonList(handleCallback), theEvent);
        }

        if (stmtCallbacks.isEmpty()) {
            return;
        }

        // Process self-join or sorted prioritized callbacks
        for (Map.Entry<AgentInstance, Object> entry : stmtCallbacks.entrySet())
        {
            AgentInstance agentInstance = entry.getKey();
            Object callbackList = entry.getValue();
            if (callbackList instanceof ArrayDeque) {
                process(agentInstance, servicesContext, (Collection<FilterHandle>) callbackList, theEvent);
            }
            else {
                process(agentInstance, servicesContext, Collections.<FilterHandle>singletonList((FilterHandle) callbackList), theEvent);
            }
            if (agentInstance.getAgentInstanceContext().getEpStatementAgentInstanceHandle().isPreemptive()) {
                return;
            }
        }
    }
View Full Code Here

Examples of com.jitlogic.zorka.core.AgentInstance

        String home = System.getProperties().getProperty("zorka.home.dir", args);

        boolean retransformSupported = supportsRetransform(instrumentation);

        AgentConfig config = new AgentConfig(ZorkaUtil.path(home));
        instance = new AgentInstance(config, instantiateRetransformer(instrumentation, config,
                "com.jitlogic.zorka.core.spy." + (retransformSupported ? "RealSpyRetransformer" : "DummySpyRetransformer")));

        instance.start();

        if (instance.getConfig().boolCfg("spy", true)) {
View Full Code Here

Examples of qat.parser.AgentInstance

 
  // -- remote
  int agentCount = Integer.parseInt(getProperty(Common.AGENT_COUNT,"0"));
  for (int i = 1; i <= agentCount; i++) {
      try {
    AgentInstance agent = new AgentInstance(getProperty("agent"+i+".host"),
              Integer.parseInt(getProperty("agent"+i+".port")),
              ".",
              inEvaluationMode());
    String statusCode = agent.EXEC_CLASS(classLoader, className);
    setProperty("0",statusCode);
   
    // now print out a message if the status was timed out
    int value = Integer.parseInt(statusCode);
    if (value == qat.agent.ExecProcess.TIMEDOUT_STATE) {
View Full Code Here

Examples of qat.parser.AgentInstance

        // check that this agentID is unused
        if (agentMap.get(agentid)!=null) {
          throw new Exception("agent identifier already exists :"+agentid.toString());
        }
        AgentInstance agentInstance =  new AgentInstance(agenthost.toString(),
            new Integer(agentport.toString()).intValue(),
            agentworkdir.toString(),
            inEvaluationMode());
        agentMap.put(agentid.toString(),agentInstance);
      }
View Full Code Here

Examples of qat.parser.AgentInstance

      StringBuffer agentid = resolveVariable(getAttribute(attributes,"agentid"));
      if (onlyIf(attributes)) {
        printStream.println("releasing agent "+agentid);
        setStatusText(releaseAgentNode.getNodeName()+" "+agentid);

        AgentInstance agentInstance = (AgentInstance)agentMap.get(agentid.toString()); // remove also returns the object it deleted
        if (agentInstance==null)
          throw new Exception("unknown agentid "+agentid);
        try {
          agentInstance.DELAGENT();
        }
        catch (Exception ex) {
          printError(RELEASEAGENT_NODE,"error cleaning up agent "+agentid+"("+ex.toString()+") :");
        }
        finally {
View Full Code Here

Examples of qat.parser.AgentInstance

      StringBuffer agentid      = resolveVariable(getAttribute(attributes,"agentid"));
      StringBuffer zipfile      = resolveVariable(getAttribute(attributes,"zipfile"));
      if (onlyIf(attributes)) {
        setStatusText(sendzipNode.getNodeName()+" "+agentid);
        printStream.println(sendzipNode.getNodeName()+" "+zipfile+" to agent "+agentid);
        AgentInstance agentInstance = (AgentInstance)agentMap.get(agentid.toString());
        if (agentInstance==null)
          throw new Exception("unknown agentid "+agentid);
        // send the zip file, and retrieve the associated zip ID
        try {
          properties.setProperty(agentid.toString()+zipfile.toString(),
              agentInstance.ZIPSEND(zipfile.toString(),agentid.toString()+zipfile.toString()));
        }
        catch (Exception ex) {
          printError(SENDZIP_NODE,"problem sending zip file to agent ("+ex.toString()+")");
        }
      }
View Full Code Here

Examples of qat.parser.AgentInstance

      StringBuffer agentid      = resolveVariable(getAttribute(attributes,"agentid"));
      StringBuffer zipfile      = resolveVariable(getAttribute(attributes,"zipfile"));
      if (onlyIf(attributes)) {
        setStatusText(cleanzipNode.getNodeName()+" "+agentid);
        printStream.println(cleanzipNode.getNodeName()+" from agent "+agentid);
        AgentInstance agentInstance = (AgentInstance)agentMap.get(agentid.toString());
        if (agentInstance==null)
          throw new Exception("unknown agentid "+agentid);
        agentInstance.ZIPCLEAN(agentid.toString()+zipfile.toString());
        properties.remove(agentid.toString()+zipfile.toString());
      }
      else {
        printStream.println("cleanzip cancelled (onlyif false)");
      }
View Full Code Here

Examples of qat.parser.AgentInstance

        cmdArray[0] = command.toString();
        int i  = 1;
        while(tokens.hasMoreTokens()) {
          cmdArray[i++] = tokens.nextToken();
        }
        AgentInstance agentInstance = (AgentInstance)agentMap.get(agentid.toString());
        if (agentInstance==null)
          throw new Exception("unknown agentid "+agentid);
        properties.setProperty(processid.toString(),
            agentInstance.CMDSTART(cmdArray, timeout.toString()));
      }
      else {
        printStream.println("start cancelled (onlyif false)");
      }
    }
View Full Code Here

Examples of qat.parser.AgentInstance

        StringBuffer processidname = getAttribute(attributes, "processid");
        StringBuffer processid = resolveVariable(processidname);    processidname = QAXMLExpression.removeVariableBraces(processidname);
        processidname = resolveVariable(processidname);
        StringBuffer result    = resolveVariable(getAttribute(attributes, "status"));
        setStatusText(statusNode.getNodeName()+" "+processidname.toString()+" "+result.toString());
        printStream.println(statusNode.getNodeName()+" "+processidname.toString()+" "+result.toString());    AgentInstance agentInstance = getAgentRunningProcess(processid);

        if (agentInstance==null)
          throw new Exception("unknown processid "+processidname);

        String statusCode = agentInstance.CMDSTATUS(processid.toString());
        if (Integer.parseInt(statusCode)==0)
          properties.setProperty(result.toString(),"passed");
        else
          properties.setProperty(result.toString(),"failed");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.