Runs a diagnostic for a given application.
@return the diagnostic
354328
public List<Diagnostic> diagnoseApplication( String applicationName ) {

		this.logger.finer( "Diagnosing application " + applicationName );
		WebResource path = this.resource.path( UrlConstants.DEBUG ).path( "diagnose-application" );
		path = path.queryParam( "application-name", applicationName );

		List<Diagnostic> result = this.wsClient.createBuilder( path )
						.accept( MediaType.APPLICATION_JSON )
						.get( new GenericType<List<Diagnostic>> () {});

		if( result == null )
			this.logger.finer( "No diagnostic was returned for application " + applicationName );

		return result;
	}
759805
public void run() {
		if (logger.isDebugEnabled()){
    		logger.debug("run");
    	}
		
		final SipContext sipContext = sipFactoryImpl.getSipApplicationDispatcher().findSipApplication(key.getApplicationName());
		if(sipContext != null) {
			SipManager sipManager = sipContext.getSipManager();
			final SipApplicationSessionKey sipApplicationSessionKey = SessionManagerUtil.getSipApplicationSessionKey(
					key.getApplicationName(), 
					key.getApplicationSessionId(),
					null);								
			MobicentsSipApplicationSession sipApplicationSession = sipManager.getSipApplicationSession(sipApplicationSessionKey, false);
			MobicentsSipSession sipSession = sipManager.getSipSession(key, false, sipFactoryImpl, sipApplicationSession);	
					
			if(sipSession != null) {				
				boolean batchStarted = false;
				ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
				try {
					sipContext.enterSipContext();	
					sipContext.enterSipApp(sipApplicationSession, sipSession, false, true);
					batchStarted = sipContext.enterSipAppHa(true);
					
					work.doAsynchronousWork(sipSession);
				} catch(Throwable t) {
					logger.error("An unexpected exception happened in the SipSessionAsynchronousWork callback on sip session " + key, t);
				} finally {
					sipContext.exitSipAppHa(null, null, batchStarted);
					sipContext.exitSipApp(sipApplicationSession, sipSession);
					sipContext.exitSipContext(oldClassLoader);				
				}
			} else {
				if(logger.isDebugEnabled()) {
					logger.debug("SipSession " + key + " couldn't be found, it may have been already invalidated.");
				}
			}
		}
	}
953009
@Override
	public Response diagnoseInstance( String applicationName, String instancePath ) {

		this.logger.fine( "Request: create a diagnostic for " + instancePath + " in application " + applicationName );
		final Application application = this.manager.applicationMngr().findApplicationByName( applicationName );
		String lang = lang( this.manager );

		final Instance instance;
		final Response response;

		if( application == null )
			response = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang ).build();
		else if(( instance = InstanceHelpers.findInstanceByPath( application, instancePath )) == null )
			response = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, instance( instancePath ), application( applicationName )), lang ).build();
		else
			response = Response.status( Status.OK ).entity( createDiagnostic( instance )).build();

		return response;
	}
826313
public Runner run() throws Exception {
		// Set up the execution environment
		env = ExecutionEnvironment.getExecutionEnvironment();
		ExecutionConfig config = env.getConfig();

		// should not have any non-Flink data types
		config.disableForceAvro();
		config.disableForceKryo();

		config.setGlobalJobParameters(parameters);
		parameterize(this);

		// configure local parameters and throw proper exception on error
		try {
			this.configure(parameters);
		} catch (RuntimeException ex) {
			throw new ProgramParametrizationException(ex.getMessage());
		}

		// integration tests run with with object reuse both disabled and enabled
		if (disableObjectReuse.getValue()) {
			config.disableObjectReuse();
		} else {
			config.enableObjectReuse();
		}

		// ----------------------------------------------------------------------------------------
		// Usage and configuration
		// ----------------------------------------------------------------------------------------

		// algorithm and usage
		if (!parameters.has(ALGORITHM)) {
			throw new ProgramParametrizationException(getAlgorithmsListing());
		}

		String algorithmName = parameters.get(ALGORITHM);
		algorithm = driverFactory.get(algorithmName);

		if (algorithm == null) {
			throw new ProgramParametrizationException("Unknown algorithm name: " + algorithmName);
		}

		// input and usage
		if (!parameters.has(INPUT)) {
			if (!parameters.has(OUTPUT)) {
				// if neither input nor output is given then print algorithm usage
				throw new ProgramParametrizationException(getAlgorithmUsage(algorithmName));
			}
			throw new ProgramParametrizationException("No input given");
		}

		parameterize(algorithm);

		String inputName = parameters.get(INPUT);
		Input input = inputFactory.get(inputName);

		if (input == null) {
			throw new ProgramParametrizationException("Unknown input type: " + inputName);
		}

		parameterize(input);

		// output and usage
		if (!parameters.has(OUTPUT)) {
			throw new ProgramParametrizationException("No output given");
		}

		String outputName = parameters.get(OUTPUT);
		output = outputFactory.get(outputName);

		if (output == null) {
			throw new ProgramParametrizationException("Unknown output type: " + outputName);
		}

		parameterize(output);

		// ----------------------------------------------------------------------------------------
		// Create list of input and algorithm transforms
		// ----------------------------------------------------------------------------------------

		List<Transform> transforms = new ArrayList<>();

		if (input instanceof Transformable) {
			transforms.addAll(((Transformable) input).getTransformers());
		}

		if (algorithm instanceof Transformable) {
			transforms.addAll(((Transformable) algorithm).getTransformers());
		}

		for (Transform transform : transforms) {
			parameterize(transform);
		}

		// unused parameters
		if (parameters.getUnrequestedParameters().size() > 0) {
			throw new ProgramParametrizationException("Unrequested parameters: " + parameters.getUnrequestedParameters());
		}

		// ----------------------------------------------------------------------------------------
		// Execute
		// ----------------------------------------------------------------------------------------

		// Create input
		Graph graph = input.create(env);

		// Transform input
		for (Transform transform : transforms) {
			graph = (Graph) transform.transformInput(graph);
		}

		// Run algorithm
		result = algorithm.plan(graph);

		// Output
		executionName = jobName.getValue() != null ? jobName.getValue() + ": " : "";

		executionName += input.getIdentity() + " ⇨ " + algorithmName + " ⇨ " + output.getName();

		if (transforms.size() > 0) {
			// append identifiers to job name
			StringBuffer buffer = new StringBuffer(executionName).append(" [");

			for (Transform transform : transforms) {
				buffer.append(transform.getIdentity());
			}

			executionName = buffer.append("]").toString();
		}

		if (output == null) {
			throw new ProgramParametrizationException("Unknown output type: " + outputName);
		}

		try {
			output.configure(parameters);
		} catch (RuntimeException ex) {
			throw new ProgramParametrizationException(ex.getMessage());
		}

		if (result != null) {
			// Transform output if algorithm returned result DataSet
			if (transforms.size() > 0) {
				Collections.reverse(transforms);
				for (Transform transform : transforms) {
					result = (DataSet) transform.transformResult(result);
				}
			}
		}

		return this;
	}
1344203
@Override
	public HashMap<String, Object> getApplicationMap() {
		return (HashMap<String, Object>) JKThreadLocal.getValue(JKContextConstants.APPLICATION_MAP);
	}
139661
public S setApplication(ApplicationConfig application) {
        if (application == null) {
            application = new ApplicationConfig();
        }
        this.application = application;
        return castThis();
    }
665846
public java.util.List<ApplicationInfo> getApplicationsInfo() {
        if (applicationsInfo == null) {
            applicationsInfo = new com.amazonaws.internal.SdkInternalList<ApplicationInfo>();
        }
        return applicationsInfo;
    }
914332
@Override
  public SparkAppHandle startApplication(SparkAppHandle.Listener... listeners) throws IOException {
    if (builder.isClientMode(builder.getEffectiveConfig())) {
      LOG.warning("It's not recommended to run client-mode applications using InProcessLauncher.");
    }

    Method main = findSparkSubmit();
    LauncherServer server = LauncherServer.getOrCreateServer();
    InProcessAppHandle handle = new InProcessAppHandle(server);
    for (SparkAppHandle.Listener l : listeners) {
      handle.addListener(l);
    }

    String secret = server.registerHandle(handle);
    setConf(LauncherProtocol.CONF_LAUNCHER_PORT, String.valueOf(server.getPort()));
    setConf(LauncherProtocol.CONF_LAUNCHER_SECRET, secret);

    List<String> sparkArgs = builder.buildSparkSubmitArgs();
    String[] argv = sparkArgs.toArray(new String[sparkArgs.size()]);

    String appName = CommandBuilderUtils.firstNonEmpty(builder.appName, builder.mainClass,
      "<unknown>");
    handle.start(appName, main, argv);
    return handle;
  }
1195871
public java.util.List<ApplicationDescription> getApplications() {
        if (applications == null) {
            applications = new com.amazonaws.internal.SdkInternalList<ApplicationDescription>();
        }
        return applications;
    }
720609
public static ApplicationContext get() {
        ClassLoader classLoader = getContextClassLoader();
        while (classLoader != null) {
            ApplicationContext applicationContext = contextMap.get(classLoader);
            if (applicationContext != null) {
                return applicationContext;
            }
            classLoader = classLoader.getParent();
        }
        return null;
    }
409473
public String run()
    {
		String locale = getLocale().getLanguage();

		SystemUnderTest sut = SystemUnderTest.newInstance(sutName);
		sut.setProject(Project.newInstance(sutProjectName));
		sut.setRunner(Runner.newInstance(""));

		Specification spec = Specification.newInstance(getPage().getTitle());

		try
		{
			spec.setRepository(gpUtil.getHomeRepository(spaceKey));

        	execution = gpUtil.getGPServerService().runSpecification(sut, spec, implemented, locale);
        } 
        catch (GreenPepperServerException e) 
        {
            execution = Execution.error(spec, sut, null, e.getId());
        }
        catch (Exception e) 
        {
            execution = Execution.error(spec, sut, null, ExceptionUtils.stackTrace(e, "<br>", 15));
        }
        
        return SUCCESS;
    }
506336
public function runApplication()
    {
        $application = $this->createNew(SymfonyApplication::class, $this->getName());
        foreach ($this->commands as $commandClass) {
            $command = $this->createNew($commandClass);
            $application->add($command);
            if ($command instanceof Command && $command->isDefaultCommand()) {            
                $application->setDefaultCommand($command->getName());
            }
        }        
        $application->run();
    }
847107
public static Result compile(DiagnosticListener<JavaFileObject> listener, String[] args) {
    return ErrorProneCompiler.builder().listenToDiagnostics(listener).build().run(args);
  }
549011
function diagnostics() {
    var args = Array.prototype.slice.call(arguments, 0);

    write.call(write, options, process(args, options));
    return true;
  }
410844
public Diagnostic diagnoseInstance( String applicationName, String instancePath )
	throws DebugWsException {

		this.logger.finer( "Diagnosing instance " + instancePath + " in application " + applicationName );

		WebResource path = this.resource.path( UrlConstants.DEBUG ).path( "diagnose-instance" );
		path = path.queryParam( "application-name", applicationName );
		path = path.queryParam( "instance-path", instancePath );

		ClientResponse response = this.wsClient.createBuilder( path )
						.accept( MediaType.APPLICATION_JSON )
						.get( ClientResponse.class );

		if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) {
			String value = response.getEntity( String.class );
			this.logger.finer( response.getStatusInfo() + ": " + value );
			throw new DebugWsException( response.getStatusInfo().getStatusCode(), value );
		}

		this.logger.finer( String.valueOf( response.getStatusInfo()));
		return response.getEntity( Diagnostic.class );
	}
1229707
protected final Application ensureApplicationReference() {
        if (this.application == null) {
            assertState();
            Application tmpApp = applicationResolver.getApplication(client, applicationRestUrl);
            if (tmpApp == null) {
                throw new IllegalStateException("ApplicationResolver returned 'null' Application, this is likely a configuration error.");
            }
            this.application = tmpApp;
        }
        return this.application;
    }
1159064
public static ConfigurableApplicationContext start(Class<?>[] app, String... args) {
        Class<?>[] apps = ObjectArrays.concat(app, GHEventApiServer.class);
        return SpringApplication.run(apps, args);
    }