Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 31D2610980 for ; Thu, 29 May 2014 00:59:03 +0000 (UTC) Received: (qmail 7031 invoked by uid 500); 29 May 2014 00:59:03 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 7000 invoked by uid 500); 29 May 2014 00:59:03 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 6985 invoked by uid 99); 29 May 2014 00:59:03 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 May 2014 00:59:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 7B3C84EC20; Thu, 29 May 2014 00:59:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Thu, 29 May 2014 00:59:02 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/3] git commit: ACCUMULO-378 Allow for dynamic reconfiguration of the WorkAssigner impl Repository: accumulo Updated Branches: refs/heads/ACCUMULO-378 58fbf1438 -> 49fc9855f ACCUMULO-378 Allow for dynamic reconfiguration of the WorkAssigner impl Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/db10cfe2 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/db10cfe2 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/db10cfe2 Branch: refs/heads/ACCUMULO-378 Commit: db10cfe26823f5a31b516070521f54e5b890fb7b Parents: 58fbf14 Author: Josh Elser Authored: Wed May 28 16:55:39 2014 -0400 Committer: Josh Elser Committed: Wed May 28 16:55:39 2014 -0400 ---------------------------------------------------------------------- .../accumulo/master/replication/WorkDriver.java | 33 +++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/db10cfe2/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java ---------------------------------------------------------------------- diff --git a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java b/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java index 00b0480..8c3e3e3 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java +++ b/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java @@ -44,20 +44,28 @@ public class WorkDriver extends Daemon { this.master = master; this.conn = conn; this.conf = master.getConfiguration().getConfiguration(); + configureWorkAssigner(); + } + protected void configureWorkAssigner() { String workAssignerClass = conf.get(Property.REPLICATION_WORK_ASSIGNER); - try { - Class clz = Class.forName(workAssignerClass); - Class workAssignerClz = clz.asSubclass(WorkAssigner.class); - this.assigner = workAssignerClz.newInstance(); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { - log.error("Could not instantiate configured work assigner {}", workAssignerClass, e); - throw new RuntimeException(e); - } - this.assigner.configure(conf, conn); - this.assignerImplName = assigner.getClass().getName(); - this.setName(assigner.getName()); + if (null == assigner || !assigner.getClass().getName().equals(workAssignerClass)) { + log.info("Initializing work assigner implementation of {}", workAssignerClass); + + try { + Class clz = Class.forName(workAssignerClass); + Class workAssignerClz = clz.asSubclass(WorkAssigner.class); + this.assigner = workAssignerClz.newInstance(); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { + log.error("Could not instantiate configured work assigner {}", workAssignerClass, e); + throw new RuntimeException(e); + } + + this.assigner.configure(conf, conn); + this.assignerImplName = assigner.getClass().getName(); + this.setName(assigner.getName()); + } } /* @@ -90,6 +98,9 @@ public class WorkDriver extends Daemon { long sleepTime = conf.getTimeInMillis(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP); log.debug("Sleeping {} ms before next work assignment", sleepTime); UtilWaitThread.sleep(sleepTime); + + // After each loop, make sure that the WorkAssigner implementation didn't change + configureWorkAssigner(); } } }