Source:
<code>public static DeleteResourceJob createDeleteProjectJob(final IProject project) { Assert.isNotNull(project, "A project must not be null"); DeleteResourceJob deleteProjectJob = new DeleteResourceJob(project) { @Override protected IStatus doRun(IProgressMonitor monitor) { Connection connection = ConnectionsRegistryUtil.getConnectionFor(project); WatchManager.getInstance().stopWatch(project); List<IProject> oldProjects = connection.getResources(ResourceKind.PROJECT); IStatus status = super.doRun(monitor); if(status.isOK()) { if(waitForServerToReconcileProjectDelete(connection, project)) { List<IProject> newProjects = new ArrayList<>(oldProjects); newProjects.remove(project); ConnectionsRegistrySingleton.getInstance().fireConnectionChanged( connection , ConnectionProperties.PROPERTY_PROJECTS, oldProjects, newProjects); } } return status; } private boolean waitForServerToReconcileProjectDelete(Connection conn, IProject project) { boolean deleted = false; long sleep = 0; do { try { conn.getResource(project); Thread.sleep(PROJECT_DELETE_DELAY); sleep = sleep + PROJECT_DELETE_DELAY; } catch (InterruptedException e1) { } catch(OpenShiftException ex) { <START> if(ex.getStatus() != null) { <END> final int code = ex.getStatus().getCode(); if(code == IHttpConstants.STATUS_NOT_FOUND || code == IHttpConstants.STATUS_FORBIDDEN) { deleted = true; } } } }while(!deleted || sleep > MAX_PROJECT_DELETE_DELAY); return deleted; } }; return deleteProjectJob; }</code><technical_language>testing this I DeleteResourceJob enlessly looping. breaking in I ex.getStatus() _null_ wont stop waiting based 404 403. sleep counter increased Thread.sleep(), exception occurrs right conn.getResource(project), skipping sleep sleepcounter increase. thread loop endlessly reach MAX_PROJECT_DELETE_DELAY value. "ex" is com.openshift.restclient.authorization.ResourceForbiddenException, message is 'User "adietish@redhat.com" get projects in project "testproj"', status is null</technical_language>

Target:
public static DeleteResourceJob createDeleteProjectJob(final IProject project) { Assert.isNotNull(project, "A project must not be null"); DeleteResourceJob deleteProjectJob = new DeleteResourceJob(project) { @Override protected IStatus doRun(IProgressMonitor monitor) { Connection connection = ConnectionsRegistryUtil.getConnectionFor(project); WatchManager.getInstance().stopWatch(project); List<IProject> oldProjects = connection.getResources(ResourceKind.PROJECT); IStatus status = super.doRun(monitor); if(status.isOK()) { if(waitForServerToReconcileProjectDelete(connection, project)) { List<IProject> newProjects = new ArrayList<>(oldProjects); newProjects.remove(project); ConnectionsRegistrySingleton.getInstance().fireConnectionChanged( connection , ConnectionProperties.PROPERTY_PROJECTS, oldProjects, newProjects); } } return status; } private boolean waitForServerToReconcileProjectDelete(Connection conn, IProject project) { boolean deleted = false; long sleep = 0; do { try { conn.getResource(project); Thread.sleep(PROJECT_DELETE_DELAY); } catch (InterruptedException e1) { } catch(OpenShiftException ex) { if(ex.getStatus() != null) { final int code = ex.getStatus().getCode(); if(code == IHttpConstants.STATUS_NOT_FOUND || code == IHttpConstants.STATUS_FORBIDDEN) { deleted = true; } } }finally { sleep = sleep + PROJECT_DELETE_DELAY; } }while(!deleted && sleep < MAX_PROJECT_DELETE_DELAY); return deleted; } }; return deleteProjectJob; }