Skip to content

Commit

Permalink
[JENKINS-5756] Removing workarounds for HotSpot bug.
Browse files Browse the repository at this point in the history
https://bugs.openjdk.java.net/browse/JDK-6933067 claims to be fixed as of Java 6, our baseline.
(cherry picked from commit 253943e)

Conflicts:
	core/src/main/java/hudson/FilePath.java
  • Loading branch information
olivergondza committed Mar 31, 2015
1 parent 9e30f50 commit 0488078
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 95 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/ClassicPluginStrategy.java
Expand Up @@ -342,7 +342,7 @@ public <T> List<ExtensionComponent<T>> findComponents(Class<T> type, Hudson huds
List<ExtensionComponent<T>> r = Lists.newArrayList();
for (ExtensionFinder finder : finders) {
try {
r.addAll(finder._find(type, hudson));
r.addAll(finder.find(type, hudson));
} catch (AbstractMethodError e) {
// backward compatibility
for (T t : finder.findExtensions(type, hudson))
Expand Down
5 changes: 1 addition & 4 deletions core/src/main/java/hudson/ExtensionFinder.java
Expand Up @@ -143,10 +143,7 @@ public boolean isRefreshable() {
*/
public abstract <T> Collection<ExtensionComponent<T>> find(Class<T> type, Hudson jenkins);

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
@Deprecated
public <T> Collection<ExtensionComponent<T>> _find(Class<T> type, Hudson hudson) {
return find(type, hudson);
}
Expand Down
28 changes: 6 additions & 22 deletions core/src/main/java/hudson/model/AbstractItem.java
Expand Up @@ -318,7 +318,11 @@ public Void call() throws IOException {
doSetName(oldName);
}

callOnRenamed(newName, parent, oldName);
try {
parent.onRenamed(this, oldName, newName);
} catch (AbstractMethodError _) {
// ignore
}

ItemListener.fireLocationChange(this, oldFullName);
}
Expand All @@ -329,18 +333,6 @@ public void movedTo(DirectlyModifiableTopLevelItemGroup destination, AbstractIte
newItem.onLoad(destination, name);
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private void callOnRenamed(String newName, ItemGroup parent, String oldName) throws IOException {
try {
parent.onRenamed(this, oldName, newName);
} catch (AbstractMethodError _) {
// ignore
}
}

/**
* Gets all the jobs that this {@link Item} contains as descendants.
*/
Expand Down Expand Up @@ -581,16 +573,8 @@ public void delete() throws IOException, InterruptedException {
synchronized (this) { // could just make performDelete synchronized but overriders might not honor that
performDelete();
} // JENKINS-19446: leave synch block, but JENKINS-22001: still notify synchronously
invokeOnDeleted();
Jenkins.getInstance().rebuildDependencyGraphAsync();
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private void invokeOnDeleted() throws IOException {
getParent().onDeleted(AbstractItem.this);
Jenkins.getInstance().rebuildDependencyGraphAsync();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/AbstractProject.java
Expand Up @@ -1270,7 +1270,7 @@ private void calcPollingBaseline(AbstractBuild build, Launcher launcher, TaskLis
SCMRevisionState baseline = build.getAction(SCMRevisionState.class);
if (baseline==null) {
try {
baseline = getScm()._calcRevisionsFromBuild(build, launcher, listener);
baseline = getScm().calcRevisionsFromBuild(build, launcher, listener);
} catch (AbstractMethodError e) {
baseline = SCMRevisionState.NONE; // pre-1.345 SCM implementations, which doesn't use the baseline in polling
}
Expand Down
10 changes: 1 addition & 9 deletions core/src/main/java/hudson/model/View.java
Expand Up @@ -255,20 +255,12 @@ public ViewGroup getOwner() {
*/
public ItemGroup<? extends TopLevelItem> getOwnerItemGroup() {
try {
return _getOwnerItemGroup();
return owner.getItemGroup();
} catch (AbstractMethodError e) {
return Jenkins.getInstance();
}
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private ItemGroup<? extends TopLevelItem> _getOwnerItemGroup() {
return owner.getItemGroup();
}

public View getOwnerPrimaryView() {
try {
return _getOwnerPrimaryView();
Expand Down
19 changes: 2 additions & 17 deletions core/src/main/java/hudson/model/queue/Executables.java
Expand Up @@ -40,7 +40,7 @@ public class Executables {
*/
public static @Nonnull SubTask getParentOf(Executable e) {
try {
return _getParentOf(e);
return e.getParent();
} catch (AbstractMethodError _) {
try {
Method m = e.getClass().getMethod("getParent");
Expand All @@ -59,32 +59,17 @@ public class Executables {
}
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private static SubTask _getParentOf(Executable e) {
return e.getParent();
}

/**
* Returns the estimated duration for the executable.
* Protects against {@link AbstractMethodError}s if the {@link Executable} implementation
* was compiled against Hudson < 1.383
*/
public static long getEstimatedDurationFor(Executable e) {
try {
return _getEstimatedDuration(e);
return e.getEstimatedDuration();
} catch (AbstractMethodError error) {
return e.getParent().getEstimatedDuration();
}
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private static long _getEstimatedDuration(Executable e) {
return e.getEstimatedDuration();
}
}
40 changes: 4 additions & 36 deletions core/src/main/java/hudson/model/queue/Tasks.java
Expand Up @@ -41,70 +41,38 @@
*/
public class Tasks {

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private static Collection<? extends SubTask> _getSubTasksOf(Task task) {
return task.getSubTasks();
}

public static Collection<? extends SubTask> getSubTasksOf(Task task) {
try {
return _getSubTasksOf(task);
return task.getSubTasks();
} catch (AbstractMethodError e) {
return Collections.singleton(task);
}
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private static Object _getSameNodeConstraintOf(SubTask t) {
return t.getSameNodeConstraint();
}

public static Object getSameNodeConstraintOf(SubTask t) {
try {
return _getSameNodeConstraintOf(t);
return t.getSameNodeConstraint();
} catch (AbstractMethodError e) {
return null;
}
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
public static Task _getOwnerTaskOf(SubTask t) {
return t.getOwnerTask();
}

public static @Nonnull Task getOwnerTaskOf(@Nonnull SubTask t) {
try {
return _getOwnerTaskOf(t);
return t.getOwnerTask();
} catch (AbstractMethodError e) {
return (Task)t;
}
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private static Authentication _getDefaultAuthenticationOf(Task t) {
return t.getDefaultAuthentication();
}

/**
* @param t a task
* @return {@link Task#getDefaultAuthentication}, or {@link ACL#SYSTEM}
* @since 1.520
*/
public static Authentication getDefaultAuthenticationOf(Task t) {
try {
return _getDefaultAuthenticationOf(t);
return t.getDefaultAuthentication();
} catch (AbstractMethodError e) {
return ACL.SYSTEM;
}
Expand Down
6 changes: 1 addition & 5 deletions core/src/main/java/hudson/scm/SCM.java
Expand Up @@ -321,10 +321,6 @@ public SCMRevisionState calcRevisionsFromBuild(AbstractBuild<?,?> build, Launche
return calcRevisionsFromBuild(build, launcher != null ? build.getWorkspace() : null, launcher, listener);
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
@Deprecated
public SCMRevisionState _calcRevisionsFromBuild(AbstractBuild<?, ?> build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
return calcRevisionsFromBuild(build, launcher, listener);
Expand Down Expand Up @@ -395,7 +391,7 @@ public final PollingResult poll(AbstractProject<?,?> project, Launcher launcher,
if (baseline!=SCMRevisionState.NONE) {
baseline2 = baseline;
} else {
baseline2 = _calcRevisionsFromBuild(project.getLastBuild(), launcher, listener);
baseline2 = calcRevisionsFromBuild(project.getLastBuild(), launcher, listener);
}

return compareRemoteRevisionWith(project, launcher, workspace, listener, baseline2);
Expand Down

0 comments on commit 0488078

Please sign in to comment.