提交 2e87c36c 编写于 作者: K Kohsuke Kawaguchi

Making this class serializable

The use case that led me here was to use this from workflow which relies primarily on Java serialization
上级 e77f79e8
...@@ -31,6 +31,8 @@ import hudson.model.User; ...@@ -31,6 +31,8 @@ import hudson.model.User;
import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean; import org.kohsuke.stapler.export.ExportedBean;
import java.io.Serializable;
/** /**
* Records why an {@linkplain Executor#interrupt() executor is interrupted}. * Records why an {@linkplain Executor#interrupt() executor is interrupted}.
* *
...@@ -44,13 +46,16 @@ import org.kohsuke.stapler.export.ExportedBean; ...@@ -44,13 +46,16 @@ import org.kohsuke.stapler.export.ExportedBean;
* Two {@link CauseOfInterruption}s that are {@linkplain Object#equals(Object) equal} will get * Two {@link CauseOfInterruption}s that are {@linkplain Object#equals(Object) equal} will get
* merged together. * merged together.
* *
* <h2>Persistence</h2>
* The implementation should be serializable both in Java serialization and XStream.
*
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
* @since 1.425 * @since 1.425
* @see Executor#interrupt(Result, CauseOfInterruption...) * @see Executor#interrupt(Result, CauseOfInterruption...)
* @see InterruptedBuildAction * @see InterruptedBuildAction
*/ */
@ExportedBean @ExportedBean
public abstract class CauseOfInterruption { public abstract class CauseOfInterruption implements Serializable {
/** /**
* Human readable description of why the build is cancelled. * Human readable description of why the build is cancelled.
*/ */
...@@ -103,5 +108,9 @@ public abstract class CauseOfInterruption { ...@@ -103,5 +108,9 @@ public abstract class CauseOfInterruption {
public int hashCode() { public int hashCode() {
return user.hashCode(); return user.hashCode();
} }
private static final long serialVersionUID = 1L;
} }
private static final long serialVersionUID = 1L;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册