Uploaded image for project: 'OpenShift Java Client'
  1. OpenShift Java Client
  2. OSJC-62

openshift java client: should not load all applications when creating a new application

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • Minor
    • None
    • 2.0.1
    • None
    • Low

    Description

      When creating a new application, the openshift-java-client would lookup if the application name already exist. When doing that it'll load the existing apps from the backend if they're not cached yet:

      stacktrace when creating a new application
      at com.openshift.internal.client.AbstractOpenShiftResource$ServiceRequest.execute(AbstractOpenShiftResource.java:137)
      	at com.openshift.internal.client.DomainResource.loadApplications(DomainResource.java:189)
      	at com.openshift.internal.client.DomainResource.getApplications(DomainResource.java:179)
      	at com.openshift.internal.client.DomainResource.getApplicationByName(DomainResource.java:141)
      	at com.openshift.internal.client.DomainResource.hasApplicationByName(DomainResource.java:151)
      	at com.openshift.internal.client.DomainResource.createApplication(DomainResource.java:126)
      	at com.openshift.internal.client.DomainResource.createApplication(DomainResource.java:112)
      
      DomainResource looks applications up, to see if the name is already used. DomainResource#createApplication
      if (hasApplicationByName(name)) {
      	throw new OpenShiftException("Application with name \"{0}\" already exists.", name);
      }
      
      DomainResource#hasApplicationByName gets the available applications:
      return getApplicationByName(name) != null;
      
      DomainResource#getApplicationByName
      IApplication matchingApplication = null;
      for (IApplication application : getApplications()) {
      	if (application.getName().equals(name)) {
      		matchingApplication = application;
      		break;
      	}
      }
      return matchingApplication;
      
      DomainResource#getApplications would load the applications from the backend if they're not loaded yet
      if (this.applications == null) {
      	this.applications = loadApplications();
      }
      return CollectionUtils.toUnmodifiableCopy(applications);
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            adietish@redhat.com André Dietisheim
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: