Skip to content
Permalink
Browse files

JENKINS-48322# remove ModelObject reference from BlueOceanUrlObjectIm…

…pl (#1609)
  • Loading branch information...
vivek committed Jan 5, 2018
1 parent f59cd10 commit 6775f8a79de9ee0c8ff428f65b436eeaff3116b4
@@ -11,11 +11,10 @@
*/
public class BlueOceanUrlObjectImpl extends BlueOceanUrlObject {

private volatile String mappedUrl;
private final ModelObject modelObject;
private final String mappedUrl;

public BlueOceanUrlObjectImpl(ModelObject modelObject) {
this.modelObject = modelObject;
this.mappedUrl = computeUrl(modelObject);
}

@Override
@@ -25,7 +24,6 @@ public BlueOceanUrlObjectImpl(ModelObject modelObject) {

@Override
public @Nonnull String getUrl() {
setUrlIfNeeded();
return mappedUrl;
}

@@ -34,20 +32,7 @@ public BlueOceanUrlObjectImpl(ModelObject modelObject) {
return "/plugin/blueocean-rest-impl/images/48x48/blueocean.png";
}

private void setUrlIfNeeded(){
String url = mappedUrl;
if(url == null){
synchronized (this){
url = mappedUrl;
if(url == null){
url = computeUrl();
this.mappedUrl = url;
}
}
}
}

private String computeUrl(){
private String computeUrl(ModelObject modelObject){
String url = null;
for(BlueOceanUrlMapper mapper: BlueOceanUrlMapper.all()){
url = mapper.getUrl(modelObject);

0 comments on commit 6775f8a

Please sign in to comment.
You can’t perform that action at this time.