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 4190BCC26 for ; Fri, 7 Mar 2014 15:54:24 +0000 (UTC) Received: (qmail 7480 invoked by uid 500); 7 Mar 2014 15:54:23 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 7402 invoked by uid 500); 7 Mar 2014 15:54:15 -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 7333 invoked by uid 99); 7 Mar 2014 15:54:12 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Mar 2014 15:54:12 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2EF6593FA6A; Fri, 7 Mar 2014 15:54:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhavanki@apache.org To: commits@accumulo.apache.org Date: Fri, 07 Mar 2014 15:54:12 -0000 Message-Id: <4920078b3997471faaf7aabfb18b2cb5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] git commit: ACCUMULO-2270 Make initialization of static threadpool thread-safe Repository: accumulo Updated Branches: refs/heads/1.5.2-SNAPSHOT f76b8e07a -> 18006d245 refs/heads/1.6.0-SNAPSHOT d2da4315c -> 9231648ae refs/heads/master 7028f1e51 -> 7b0e4635b ACCUMULO-2270 Make initialization of static threadpool thread-safe Signed-off-by: Bill Havanki Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/18006d24 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/18006d24 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/18006d24 Branch: refs/heads/1.5.2-SNAPSHOT Commit: 18006d245372640472ecc9f987a32cb989cb3be6 Parents: f76b8e0 Author: Vikram Srivastava Authored: Tue Jan 28 23:29:10 2014 -0800 Committer: Bill Havanki Committed: Fri Mar 7 10:43:40 2014 -0500 ---------------------------------------------------------------------- .../apache/accumulo/server/master/tableOps/BulkImport.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/18006d24/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java index 5e85277..2281eea 100644 --- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java +++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java @@ -476,19 +476,20 @@ class LoadFiles extends MasterRepo { return 500; return 0; } - - synchronized void initializeThreadPool(Master master) { + + private static synchronized ExecutorService getThreadPool(Master master) { if (threadPool == null) { int threadPoolSize = master.getSystemConfiguration().getCount(Property.MASTER_BULK_THREADPOOL_SIZE); ThreadPoolExecutor pool = new SimpleThreadPool(threadPoolSize, "bulk import"); pool.allowCoreThreadTimeOut(true); threadPool = new TraceExecutorService(pool); } + return threadPool; } @Override public Repo call(final long tid, final Master master) throws Exception { - initializeThreadPool(master); + ExecutorService executor = getThreadPool(master); final SiteConfiguration conf = ServerConfiguration.getSiteConfiguration(); FileSystem fs = master.getFileSystem(); List files = new ArrayList(); @@ -525,7 +526,7 @@ class LoadFiles extends MasterRepo { // Use the threadpool to assign files one-at-a-time to the server final List loaded = Collections.synchronizedList(new ArrayList()); for (final String file : filesToLoad) { - results.add(threadPool.submit(new Callable>() { + results.add(executor.submit(new Callable>() { @Override public List call() { List failures = new ArrayList();