New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JENKINS-53353 Do not cache results of View.getActions() #3608

Merged
merged 4 commits into from Sep 27, 2018
Jump to file or symbol
Failed to load files and symbols.
+13 −18
Diff settings

Always

Just for now

@@ -116,7 +116,6 @@
import java.util.stream.Collectors;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static jenkins.scm.RunWithSCM.*;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
@@ -172,8 +171,6 @@
*/
protected boolean filterQueue;
protected transient List<Action> transientActions;

This comment has been minimized.

@jtnord

jtnord Sep 12, 2018

Member

NB: this is a backwards incompatible API change (however a search of public sources in the jenkinsci org found no usage of it.

/**
* List of {@link ViewProperty}s configured for this view.
* @since 1.406
@@ -549,21 +546,20 @@ public String getSearchUrl() {
* @see Jenkins#getActions()
*/
public List<Action> getActions() {
List<Action> result = new ArrayList<Action>();
result.addAll(getOwner().getViewActions());
synchronized (this) {
if (transientActions == null) {
updateTransientActions();
}
result.addAll(transientActions);
}
return result;
}
public synchronized void updateTransientActions() {
This conversation was marked as resolved by oleg-nenashev

This comment has been minimized.

@jtnord

jtnord Sep 12, 2018

Member

NB: this is a backwards incompatable API change (however a search of public sources in the jenkinsci org found no usage of it.

This comment has been minimized.

@oleg-nenashev
transientActions = TransientViewActionFactory.createAllFor(this);
List<Action> result = new ArrayList<>();
result.addAll(getOwner().getViewActions());
result.addAll(TransientViewActionFactory.createAllFor(this));
return result;
}
/**
* No-op. Included to maintain backwards compatibility.
* @deprecated This method does nothing and should not be used
*/
@Restricted(DoNotUse.class)
@Deprecated
public void updateTransientActions() {}
public Object getDynamic(String token) {
for (Action a : getActions()) {
String url = a.getUrlName();
@@ -993,7 +989,6 @@ public final synchronized void doConfigSubmit( StaplerRequest req, StaplerRespon
rename(req.getParameter("name"));
getProperties().rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors());
updateTransientActions();
save();
ProTip! Use n and p to navigate between commits in a pull request.