diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 6264a07c9b..7466d9d6af 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -140,18 +140,21 @@ import org.apache.tools.zip.ZipEntry; * The following code shows the example: * *
- * FilePath file = ...;
- *
- * // make 'file' a fresh empty directory.
- * file.act(new FileCallable<Void>() {
- * // if 'file' is on a different node, this FileCallable will
- * // be transfered to that node and executed there.
- * public Void invoke(File f,VirtualChannel channel) {
- * // f and file represents the same thing
- * f.deleteContents();
- * f.mkdirs();
- * }
- * });
+ * void someMethod(FilePath file) {
+ * // make 'file' a fresh empty directory.
+ * file.act(new Freshen());
+ * }
+ * // if 'file' is on a different node, this FileCallable will
+ * // be transferred to that node and executed there.
+ * private static final class Freshen implements FileCallable<Void> {
+ * private static final long serialVersionUID = 1;
+ * @Override public Void invoke(File f, VirtualChannel channel) {
+ * // f and file represent the same thing
+ * f.deleteContents();
+ * f.mkdirs();
+ * return null;
+ * }
+ * }
*
*
*
@@ -852,7 +855,7 @@ public final class FilePath implements Serializable {
/**
* Code that gets executed on the machine where the {@link FilePath} is local.
* Used to act on {@link FilePath}.
- *
+ * Warning: implementations must be serializable, so prefer a static nested class to an inner class.
* @see FilePath#act(FileCallable)
*/
public interface FileCallable