Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-17469

The External Resources Manager should handle the state changes of the ExternalResource object

    Details

    • Similar Issues:

      Description

      There should be a clearer separation of concerns where the resource manager is responsible for the state changes of the ExternalResource object so that we do not need constructs like:

      [pseudocode]
      manager.lock(resource, "Locked by me")
      resource.setLocked(info)
      // Do some work before unlocking...
      manager.release(resource)
      resource.setLocked(null)

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Patrik Johansson
          Path:
          src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/ExternalResourceQueueTaskDispatcher.java
          src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/ReleaseRunListener.java
          src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/SelectionCriteria.java
          src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/data/ExternalResource.java
          src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/DefaultExternalResourceManager.java
          src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/ExternalResourceManager.java
          src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/NoopExternalResourceManager.java
          src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/ResourceMonitorExternalResourceManager.java
          src/test/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/NoopExternalResourceManagerHudsonTest.java
          src/test/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/ExternalResourceManagerTest.java
          http://jenkins-ci.org/commit/external-resource-dispatcher-plugin/b87513b074b74d2cec18945ebe76fb9106faf314
          Log:
          [FIXED JENKINS-17469] Clearer separation of concerns

          Refactoring classses to make the concerns of each class clearer.

          All state changes of an ExternalResource are now made by the
          ExternalResourceManager instead of whatever object is requesting the
          resource.

          To make this happen, the reserve/lock/release methods have been re-written using the
          Template Method Pattern, implementing the state change flow in the abstract base class
          and letting sub-classes continue to implement the inner locking mechanism by calling the
          abstract method reservation/locking/releasingMechanism().

          A sequence diagram of the new plugin flow can be seen here:
          http://www.websequencediagrams.com/cgi-bin/cdraw?lz=cGFydGljaXBhbnQgRXh0ZXJuYWxSZXNRdWV1ZVRhc2tEaXNwYXRjaGVyCgAfDFNlbGVjdGlvbkNyaXRlcmlhABENUmVsZWFzZVJ1bkxpc3RlbgAuDwBdC291cmNlTWFuYWcAUg9BdmFpbGFiaWxpdHlGaWx0ACQfCgpvcHQgV2hlbiBsb29raW5nIGZvciBleGVjdXRvcgoAgT0eLT4AXRM6IGdldACBGxBzTGlzdChub2RlKQAeNmYAgUcFRW5hYmxlZGFuZACBYQdsZSgAGjdnZXRNYXRjaGluZwCBHAkAKCQAgm4XOiByZXNlcnZlKHIAgxcHAIFcDQCDJAwAMhM6IHNldFIAOwZkKCkKZW5kAIMPC2pvYiBzdGFydHMKAIQvESAtLT4AexgAgQoIKSAgW2lmIG5vdACBHQhkXSAAgQYYIACBURMgOgCBEQ4AcxMAgX4bbG9jawCBXDpMb2NrAIF9F2ZpbmlzaGVzCgCGJhIAgXsaIHIAhl8GKCkAgWoZAIJAEgB-DG51bGwAgxwG&s=default

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Patrik Johansson Path: src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/ExternalResourceQueueTaskDispatcher.java src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/ReleaseRunListener.java src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/SelectionCriteria.java src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/data/ExternalResource.java src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/DefaultExternalResourceManager.java src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/ExternalResourceManager.java src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/NoopExternalResourceManager.java src/main/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/ResourceMonitorExternalResourceManager.java src/test/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/NoopExternalResourceManagerHudsonTest.java src/test/java/com/sonyericsson/jenkins/plugins/externalresource/dispatcher/utils/resourcemanagers/ExternalResourceManagerTest.java http://jenkins-ci.org/commit/external-resource-dispatcher-plugin/b87513b074b74d2cec18945ebe76fb9106faf314 Log: [FIXED JENKINS-17469] Clearer separation of concerns Refactoring classses to make the concerns of each class clearer. All state changes of an ExternalResource are now made by the ExternalResourceManager instead of whatever object is requesting the resource. To make this happen, the reserve/lock/release methods have been re-written using the Template Method Pattern, implementing the state change flow in the abstract base class and letting sub-classes continue to implement the inner locking mechanism by calling the abstract method reservation/locking/releasingMechanism(). A sequence diagram of the new plugin flow can be seen here: http://www.websequencediagrams.com/cgi-bin/cdraw?lz=cGFydGljaXBhbnQgRXh0ZXJuYWxSZXNRdWV1ZVRhc2tEaXNwYXRjaGVyCgAfDFNlbGVjdGlvbkNyaXRlcmlhABENUmVsZWFzZVJ1bkxpc3RlbgAuDwBdC291cmNlTWFuYWcAUg9BdmFpbGFiaWxpdHlGaWx0ACQfCgpvcHQgV2hlbiBsb29raW5nIGZvciBleGVjdXRvcgoAgT0eLT4AXRM6IGdldACBGxBzTGlzdChub2RlKQAeNmYAgUcFRW5hYmxlZGFuZACBYQdsZSgAGjdnZXRNYXRjaGluZwCBHAkAKCQAgm4XOiByZXNlcnZlKHIAgxcHAIFcDQCDJAwAMhM6IHNldFIAOwZkKCkKZW5kAIMPC2pvYiBzdGFydHMKAIQvESAtLT4AexgAgQoIKSAgW2lmIG5vdACBHQhkXSAAgQYYIACBURMgOgCBEQ4AcxMAgX4bbG9jawCBXDpMb2NrAIF9F2ZpbmlzaGVzCgCGJhIAgXsaIHIAhl8GKCkAgWoZAIJAEgB-DG51bGwAgxwG&s=default

            People

            • Assignee:
              patrik Patrik Johansson
              Reporter:
              patrik Patrik Johansson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: