class YarnResourceConnector implements ResourceConnector<Object> {

    @Override
    public List<CloudResourceStatus> launch(AuthenticatedContext authenticatedContext, CloudStack stack, PersistenceNotifier persistenceNotifier,
            AdjustmentType adjustmentType, Long threshold) throws Exception {
        YarnClient yarnClient = yarnClientUtil.createYarnClient(authenticatedContext);
        String applicationName = createApplicationName(authenticatedContext);

        if (!checkApplicationAlreadyCreated(yarnClient, applicationName)) {
            CreateApplicationRequest createApplicationRequest = createRequest(stack, applicationName);
            createApplication(yarnClient, createApplicationRequest);
        }

        CloudResource yarnApplication = new Builder().type(YARN_APPLICATION).name(applicationName).build();
        persistenceNotifier.notifyAllocation(yarnApplication, authenticatedContext.getCloudContext());
        return check(authenticatedContext, Collections.singletonList(yarnApplication));
    }

}