From 0cee864dc22f1bbfc6da3a0c087a2fe0e1001ea7 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Mon, 14 May 2007 17:29:08 +0000 Subject: [PATCH] Slave is not serializable. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3318 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/Slave.java | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index 0e5cc22780..ed61089175 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -315,15 +315,7 @@ public final class Slave implements Node, Serializable { } // install log handler - channel.call(new Callable() { - public Void call() { - // avoid double installation of the handler - Logger logger = Logger.getLogger("hudson"); - logger.removeHandler(SLAVE_LOG_HANDLER); - logger.addHandler(SLAVE_LOG_HANDLER); - return null; - } - }); + channel.call(new LogInstaller()); // prevent others from seeing a channel that's not properly initialized yet @@ -482,6 +474,22 @@ public final class Slave implements Node, Serializable { return this; } + /** + * This field is used on each slave node to record log records on the slave. + */ + private static final RingBufferLogHandler SLAVE_LOG_HANDLER = new RingBufferLogHandler(); + + private static class LogInstaller implements Callable { + public Void call() { + // avoid double installation of the handler + Logger logger = Logger.getLogger("hudson"); + logger.removeHandler(SLAVE_LOG_HANDLER); + logger.addHandler(SLAVE_LOG_HANDLER); + return null; + } + private static final long serialVersionUID = 1L; + } + // // backwrad compatibility // @@ -501,9 +509,4 @@ public final class Slave implements Node, Serializable { * @deprecated */ private transient String command; - - /** - * This field is used on each slave node to record log records on the slave. - */ - private static final RingBufferLogHandler SLAVE_LOG_HANDLER = new RingBufferLogHandler(); }