public Instance startMachine(String workspaceId,MachineConfig machineConfig) throws ServerException, ConflictException, NotFoundException {
  try (StripedLocks.ReadLock lock=stripedLocks.acquireReadLock(workspaceId)){
    getRunningState(workspaceId);
  }
   List<String> agents=Collections.singletonList("org.eclipse.che.terminal");
  Instance instance=environmentEngine.startMachine(workspaceId,machineConfig,agents);
  launchAgents(instance,agents);
  try (StripedLocks.WriteLock lock=stripedLocks.acquireWriteLock(workspaceId)){
    WorkspaceState workspaceState=workspaces.get(workspaceId);
    if (workspaceState == null || workspaceState.status != RUNNING) {
      try {
        environmentEngine.stopMachine(workspaceId,instance.getId());
      }
 catch (      NotFoundException|ServerException|ConflictException e) {
        LOG.error(e.getLocalizedMessage(),e);
      }
      throw new ConflictException(format("Environment of workspace '%s' was stopped during start of  machine",workspaceId));
    }
  }
   return instance;
}

public Instance startMachine ( String workspaceId , MachineConfig machineConfig ) throws ServerException , ConflictException , NotFoundException { try ( StripedLocks . ReadLock lock = stripedLocks . acquireReadLock ( workspaceId ) ) { getRunningState ( workspaceId ) ; } List < String > agents = Collections . singletonList ( "org.eclipse.che.terminal" ) ; Instance instance = environmentEngine . startMachine ( workspaceId , machineConfig , agents ) ; launchAgents ( instance , agents ) ; try ( StripedLocks . WriteLock lock = stripedLocks . acquireWriteLock ( workspaceId ) ) { WorkspaceState workspaceState = workspaces . get ( workspaceId ) ; if ( workspaceState == null || workspaceState . status != RUNNING ) { try { environmentEngine . stopMachine ( workspaceId , instance . getId ( ) ) ; } catch ( NotFoundException | ServerException | ConflictException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } throw new ConflictException ( format ( "Environment of workspace '%s' was stopped during start of  machine" , workspaceId ) ) ; } } return instance ; }
starts machine in running workspace .
