The JVM agent entry point
@param agentArgs
@param inst
355160
public static void premain(String agentArgs, Instrumentation inst) {
        System.out.println(STARTUP_NOTICE) ;
        JMXetricAgent a = null ;
        try {
            a = new JMXetricAgent();
            XMLConfigurationService.configure(a, agentArgs);
            a.start();
        } catch ( Exception ex ) {
            // log.severe("Exception starting JMXetricAgent");
            ex.printStackTrace();
        }
    }
928967
public static void main(String[] args) throws Exception {
    Configuration conf = HBaseConfiguration.create();
    String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
    if (otherArgs.length < 2) {
      usage("Wrong number of arguments: " + otherArgs.length);
      System.exit(-1);
    }
    if (conf.get(BigtableOptionsFactory.PROJECT_ID_KEY) == null) {
      usage("Must specify the property " + BigtableOptionsFactory.PROJECT_ID_KEY);
      System.exit(-1);
    }
    if (conf.get(BigtableOptionsFactory.INSTANCE_ID_KEY) == null) {
      usage("Must specify the property" + BigtableOptionsFactory.INSTANCE_ID_KEY);
      System.exit(-1);
    }

    Job job = createSubmittableJob(conf, otherArgs);
    System.exit(job.waitForCompletion(true)? 0 : 1);
  }
123389
@Override
    public void loadAgentLibrary(String agentLibrary, String options)
        throws AgentLoadException, AgentInitializationException, IOException
    {
        loadAgentLibrary(agentLibrary, false, options);
    }
1198564
@Check
	public void checkSuperConstructor(SarlAgent agent) {
		checkSuperConstructor(
				agent,
				XTEND_TYPE_DECLARATION__NAME,
				doGetConstructorParameterTypes(Agent.class, agent));
	}
673068
public static void main(final String[] args) throws InjectionException, IOException {

    final ClientProtocol.DriverClientConfiguration.Builder builder =
        ClientProtocol.DriverClientConfiguration.newBuilder();
    builder.setJobid("HelloREEF");
    builder.setEnableHttpDriver(false);
    builder.setOperatingSystem(ClientProtocol.DriverClientConfiguration.OS.LINUX);
    builder.setAzbatchRuntime(ClientProtocol.AzureBatchRuntimeParameters.newBuilder()
        .build());
    builder.addGlobalLibraries(EnvironmentUtils.getClassLocation(HelloDriver.class));

    JavaClientLauncher.submit(builder.build(), DRIVER_CONFIG);
    LOG.log(Level.INFO, "REEF job completed");
    ThreadLogger.logThreads(LOG, Level.FINE, "Threads running at the end of HelloREEF:");
  }
634717
protected void assembleArguments()
            throws MojoExecutionException {
        if (XhasMember) {
            ajcOptions.add("-XhasMember");
        }

        // Add classpath
        ajcOptions.add("-classpath");
        ajcOptions.add(AjcHelper.createClassPath(project, null, getClasspathDirectories()));

        // Add boot classpath
        if (null != bootclasspath) {
            ajcOptions.add("-bootclasspath");
            ajcOptions.add(bootclasspath);
        }

        if (null != Xjoinpoints) {
            ajcOptions.add("-Xjoinpoints:" + Xjoinpoints);
        }

        // Add warn option
        if (null != warn) {
            ajcOptions.add("-warn:" + warn);
        }

        if (null != proc) {
            ajcOptions.add("-proc:" + proc);
        }

        if (Xset != null && !Xset.isEmpty()) {
            StringBuilder sb = new StringBuilder("-Xset:");
            for (Map.Entry<String, String> param : Xset.entrySet()) {
                sb.append(param.getKey());
                sb.append("=");
                sb.append(param.getValue());
                sb.append(',');
            }
            ajcOptions.add(sb.substring(0, sb.length() - 1));
        }

        // Add artifacts or directories to weave
        String joinedWeaveDirectories = null;
        if (weaveDirectories != null) {
            joinedWeaveDirectories = StringUtils.join(weaveDirectories, File.pathSeparator);
        }
        addModulesArgument("-inpath", ajcOptions, weaveDependencies, joinedWeaveDirectories,
                "dependencies and/or directories to weave");

        // Add library artifacts
        addModulesArgument("-aspectpath", ajcOptions, aspectLibraries, getAdditionalAspectPaths(),
                "an aspect library");

        // Add xmlConfigured option and argument
        if (null != xmlConfigured) {
            ajcOptions.add("-xmlConfigured");
            ajcOptions.add(xmlConfigured.getAbsolutePath());
        }

        // add target dir argument
        ajcOptions.add("-d");
        ajcOptions.add(getOutputDirectory().getAbsolutePath());

        ajcOptions.add("-s");
        ajcOptions.add(getGeneratedSourcesDirectory().getAbsolutePath());

        // Add all the files to be included in the build,
        if (null != ajdtBuildDefFile) {
            resolvedIncludes = AjcHelper.getBuildFilesForAjdtFile(ajdtBuildDefFile, basedir);
        } else {
            resolvedIncludes = getIncludedSources();
        }
        ajcOptions.addAll(resolvedIncludes);
    }
1267697
function main() {
    agents.forEach(function (agent) {
        var r = agentdb.lookupPattern(agent.agent);
        if (r !== null) {
            if (agent.groupId == 1) {   // Unknown group -> update agent
                updateAgent(agent.id, r.group, r.source, 2);
            } else if (agent.status != 1) {
                if (r.group == agent.group) {
                    if ((agent.source == 'Unknown') &&
                        (r.source != 'Unknown')) {  // Unknown source -> update agent
                        updateAgent(agent.id, r.group, r.source, 2);
                    } else if ((agent.source == r.source) && (agent.status != 2)) { // 2 is good
                        updateStatus(agent.id, 2);
                    } else if ((agent.source != r.source) && (agent.status != 3)) { // must include exact.
                        updateStatus(agent.id, 1);
                    }
                } else if (agent.status != 3) { // need to include exact.
                    updateStatus(agent.id, 1);
                }
            } else if ((r.group == agent.group) && (r.source == agent.source)) {    // can use pattern
                updateStatus(agent.id, 2);
            }
        } else {
            r = agentdb.lookupHash(agent.agent);
            if (r !== null) {
                if ((r.group != agent.group) || (r.source != agent.source)) {
                    if (debug) { console.error("ERROR: lookup did not match: " + agent.agent); }
                    if (debug) { console.error("  lookup.group=" + r.group+", expected="+agent.group+", lookup.source=" + r.source + ", expected="+agent.source); }
                } else if ((agent.status != 1) && (agent.status != 3)) {
                    updateStatus(agent.id, 1);
                }
            } else {
                if ((agent.status < 3) && ((agent.group != "Unknown") || (agent.source != "Unknown"))) {
                    if (debug) { console.error("ERROR: missing:" + agent.agent); }
                    notfound.push(agent);
                }
            }
        }
    });
    
    if (notfound.length > 0) {
        console.error("Warning: user-agents were not found: " + notfound.length);
        if (createMissing) {
            notfound.forEach(function (agent) {
                addInsert(agent);
            });
        }
    }
}
1197445
public static void main(String[] args) throws Exception {
    // Parse the command line arguments.
    final List<String> unknown = new ArrayList<>();
    final Namespace namespace = parseArgs(args, unknown);
    final Namespace extraArgs = parseUnknown(unknown);
    extraArgs.getAttrs().forEach((key, value) -> System.setProperty(key, value.toString()));

    final Logger logger = createLogger(namespace);

    final Atomix atomix = buildAtomix(namespace);
    atomix.start().join();
    logger.info("Atomix listening at {}", atomix.getMembershipService().getLocalMember().address());

    final ManagedRestService rest = buildRestService(atomix, namespace);
    rest.start().join();
    logger.warn("The Atomix HTTP API is BETA and is intended for development and debugging purposes only!");
    logger.info("HTTP server listening at {}", rest.address());

    synchronized (Atomix.class) {
      while (atomix.isRunning()) {
        Atomix.class.wait();
      }
    }
  }
767957
public void callArgVisitors(XPathVisitor visitor)
  {
      for (int i = 0; i < m_argVec.size(); i++)
      {
         Expression exp = (Expression)m_argVec.elementAt(i);
         exp.callVisitors(new ArgExtOwner(exp), visitor);
      }
    
  }
1287496
public void setup() {

        LogActivator.logToFile(logger, this.getName(), Level.ALL);

        // Add the agent to the introspector and obtain the introspector
        // instance.
        introspector = JadeAgentIntrospector.getMyInstance(this);
        logger.fine("Agent " + this.getLocalName()
                + " added to the Intrsopector");

        try {
            this.myMockConfiguration = (MockConfiguration) this.getArguments()[0];
        } catch (Exception e) {
            logger.warning("There was an error reading the BridgeMockAgent configuration.");
            logger.fine("The stack trace: \n" + e.getStackTrace());
            // TODO think about implement this exception or not.
            // throw new BadConfigurationException();
            throw new IllegalArgumentException(
                    "The mock agent didn't receive a configuration"
                            + " object. The first argument have to be a MockConfiguration object");
        }

        // Initialize the believes counts and the mailbox list. 
//        introspector.storeBeliefValue(this, Definitions.RECEIVED_MESSAGE_COUNT, 0);
//        introspector.storeBeliefValue(this, Definitions.SENDED_MESSAGE_COUNT, 0);
        this.mailbox = new ArrayList<ACLMessage>();

        // Attemps to register the aggent.
        boolean register = false;
        for (int i = 0; !register; i++) {
            try {
                AgentRegistration.registerAgent(this,
                        myMockConfiguration.getDFservice(),
                        Definitions.BRIDGE_SERVICE_TYPE);
                // TODO Service_Type could be a custom field of
                // MockCondiguration.
                register = true;
            } catch (FIPAException e) {
                logger.warning("Exception while registering the RespositoryMockAgent");
            }
            if (i >= Definitions.REG_ATTEMPTS) {
                break;
                // TODO check if is necessary to implement this exception.
                // throw new
                // UnableToRegisterException(e.getStackTrace().toString());
            }
        }

        // Adds the behavior that listen for incoming messages.
        addBehaviour(new Listen(this));
    }
1032157
@Check(CheckType.FAST)
	public void checkSuperType(SarlAgent agent) {
		checkSuperTypes(
				agent,
				SARL_AGENT__EXTENDS,
				Utils.singletonList(agent.getExtends()),
				Agent.class,
				false);
	}
592430
public void init(String[] args)
    {
        BaseApplet applet = null;
        if (!gbStandAlone)
            applet = this;
        if (m_application == null)
        {
            Map<String,Object> properties = null;
            if (args != null)
            {
                properties = new Hashtable<String,Object>();
                Util.parseArgs(properties, args);
            }
            m_application = new ThinApplication(null, properties, applet);      // Start the session for this user
        }
        m_application.addTask(this, null);                    // Add this session to the list
        
        m_recordOwnerCollection = new RecordOwnerCollection(this);

        try   {	// Add browser connection if running as an applet
            Class.forName("netscape.javascript.JSObject"); // Test if this exists
            Map<String,Object> mapInitialCommand = new HashMap<String,Object>();
            String strInitialCommand = this.getInitialCommand(true);
            if ((strInitialCommand != null) && (strInitialCommand.length() > 0))
            	Util.parseArgs(mapInitialCommand, strInitialCommand);
            BrowserManager bm = new BrowserManager(this, mapInitialCommand);	// This will throw an exception if there is a no browser
            this.setBrowserManager(bm);
        } catch (Exception ex)  { // Ignore if no browser
        }
        if (m_application.getProperty("hash") != null)
        {	// Special case - html hash params get added (and override) initial params
            Map<String,Object> properties = this.getProperties();
            if (properties == null)
            	properties = new Hashtable<String,Object>();
        	Util.parseArgs(properties, m_application.getProperty("hash"));
        	this.setProperties(properties);
        }
        m_parent = this.addBackground(this);
        this.addSubPanels(m_parent, Constants.DONT_PUSH_TO_BROWSER);    // Add any sub-panels now

        this.setupLookAndFeel(null);
        
        if (this.getBrowserManager() != null)
        	if ((this.getClass().getName().indexOf(".thin.") != -1) || (this.getClass().getName().indexOf(".Thin") != -1))
        		this.repaint();		// HACK - On thin if this is in an applet window, the paint sequence displays the overlays backward
    }
629354
@Override ImmutableSet<String> getExtraCommandLineArgs() {
    String agentJar = options.get(ALLOCATION_AGENT_JAR_OPTION);
    if (Strings.isNullOrEmpty(agentJar)) {
      try {
        Optional<File> instrumentJar = findAllocationInstrumentJarOnClasspath();
        // TODO(gak): bundle up the allocation jar and unpack it if it's not on the classpath
        if (instrumentJar.isPresent()) {
          agentJar = instrumentJar.get().getAbsolutePath();
        }
      } catch (IOException e) {
        logger.log(SEVERE,
            "An exception occurred trying to locate the allocation agent jar on the classpath", e);
      }
    }
    if (Strings.isNullOrEmpty(agentJar) || !new File(agentJar).exists()) {
      throw new IllegalStateException("Can't find required allocationinstrumenter agent jar");
    }
    // Add microbenchmark args to minimize differences in the output
    return new ImmutableSet.Builder<String>()
        .addAll(super.getExtraCommandLineArgs())
        // we just run in interpreted mode to ensure that intrinsics don't break the instrumentation
        .add("-Xint")
        .add("-javaagent:" + agentJar)
        // Some environments rename files and use symlinks to improve resource caching,
        // if the agent jar path is actually a symlink it will prevent the agent from finding itself
        // and adding itself to the bootclasspath, so we do it manually here.
        .add("-Xbootclasspath/a:" + agentJar)
        .build();
  }
572631
private void addAgent(AsteriskAgentImpl agent)
    {
        synchronized (agents)
        {
            agents.put(agent.getAgentId(), agent);
        }
        server.fireNewAgent(agent);
    }
625885
private static void loadAgent(Config config, Log log, String agentJar, Class<?> vmClass) {
	try {

	    // addAttach(config,log);

	    // first obtain the PID of the currently-running process
	    // ### this relies on the undocumented convention of the
	    // RuntimeMXBean's
	    // ### name starting with the PID, but there appears to be no other
	    // ### way to obtain the current process' id, which we need for
	    // ### the attach process
	    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
	    String pid = runtime.getName();
	    if (pid.indexOf("@") != -1) pid = pid.substring(0, pid.indexOf("@"));
	    log.info("Instrumentation", "pid:" + pid);
	    // JDK1.6: now attach to the current VM so we can deploy a new agent
	    // ### this is a Sun JVM specific feature; other JVMs may offer
	    // ### this feature, but in an implementation-dependent way
	    Object vm = vmClass.getMethod("attach", new Class<?>[] { String.class }).invoke(null, new Object[] { pid });
	    // now deploy the actual agent, which will wind up calling
	    // agentmain()
	    vmClass.getMethod("loadAgent", new Class[] { String.class }).invoke(vm, new Object[] { agentJar });
	    vmClass.getMethod("detach", new Class[] {}).invoke(vm, new Object[] {});
	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	    // Log the message from the exception. Don't log the entire
	    // stack as this is expected when running on a JDK that doesn't
	    // support the Attach API.
	    log.log(Log.LEVEL_INFO, "Instrumentation", t);

	}
    }
1013346
protected void fireAgentSpawnedInAgent(UUID spawningAgent, AgentContext context, Agent agent, Object... initializationParameters) {
		// Notify the listeners on the lifecycle events inside
		// the just spawned agent.
		// Usually, only BICs and the AgentLifeCycleSupport in
		// io.janusproject.kernel.bic.StandardBuiltinCapacitiesProvider
		// is invoked.
		final ListenerCollection<SpawnServiceListener> list;
		synchronized (this.agentLifecycleListeners) {
			list = this.agentLifecycleListeners.get(agent.getID());
		}
		if (list != null) {
			final List<Agent> singleton = Collections.singletonList(agent);
			for (final SpawnServiceListener l : list.getListeners(SpawnServiceListener.class)) {
				l.agentSpawned(spawningAgent, context, singleton, initializationParameters);
			}
		}
	}
767249
public void setAgents(java.util.Collection<AgentListEntry> agents) {
        if (agents == null) {
            this.agents = null;
            return;
        }

        this.agents = new java.util.ArrayList<AgentListEntry>(agents);
    }