Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0E0C7200C04 for ; Tue, 24 Jan 2017 23:04:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0C909160B3E; Tue, 24 Jan 2017 22:04:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 57635160B38 for ; Tue, 24 Jan 2017 23:04:49 +0100 (CET) Received: (qmail 22156 invoked by uid 500); 24 Jan 2017 22:04:48 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 22145 invoked by uid 99); 24 Jan 2017 22:04:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2017 22:04:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 08F791A01FE for ; Tue, 24 Jan 2017 22:04:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.998 X-Spam-Level: X-Spam-Status: No, score=-1.998 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id j9BMKjm2VI_Z for ; Tue, 24 Jan 2017 22:04:46 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 6C7C35F3BF for ; Tue, 24 Jan 2017 22:04:46 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 09600E040C for ; Tue, 24 Jan 2017 22:04:28 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 88B3D25296 for ; Tue, 24 Jan 2017 22:04:26 +0000 (UTC) Date: Tue, 24 Jan 2017 22:04:26 +0000 (UTC) From: "Sean Busbey (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-12894) Upgrade Jetty to 9.2.6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 24 Jan 2017 22:04:50 -0000 [ https://issues.apache.org/jira/browse/HBASE-12894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15836720#comment-15836720 ] Sean Busbey commented on HBASE-12894: ------------------------------------- {quote} bq. Possible doublecheck on org.apache.hadoop.hbase.rest.model.ScannerModel.jsonProvider in org.apache.hadoop.hbase.rest.model.ScannerModel.getJasonProvider() It is done that way intentionally to use double checked locking to lazy initialize the instance. {quote} The check as done here is incorrect: {code} + // The singleton JacksonJaxbJsonProvider instance + private static JacksonJaxbJsonProvider jsonProvider; + private static final Object jsonProviderLock = new Object(); + + /** + * Get the JacksonJaxbJsonProvider instance; + * + * @return A JacksonJaxbJsonProvider. + */ + @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="DC", + justification="Intentional. Done this way to allow lazy init. See HBASE-12894") + private static JacksonJaxbJsonProvider getJasonProvider() { + if (jsonProvider == null) { + synchronized (jsonProviderLock) { + if (jsonProvider == null) { + jsonProvider = new JacksonJaxbJsonProvider(); + } + } + } + return jsonProvider; + } {code} You have to make {{jsonProvider}} {{volatile}} in order for this double checking to work. Otherwise another reader of jsonProvider might use it while it isn't fully initialized. You should also copy it to a local variable before checking it, so that you don't have to read the volatile variable twice on the happy path. (without these two things we have the common antipattern version, see the [Java Concurrency In Practice code listings|http://jcip.net.s3-website-us-east-1.amazonaws.com/listings.html], specifically #16.7 Overall, I believe the preferred approach for doing lazy initialization of a singleton is to use the "lazy initialization holder class idiom", where you create an inner class that contains the final static variable. That way you can safely reference it and the first time it's referenced is when the inner class and the member will be initialized. this blog has a decent overview and a microbenchmark: http://literatejava.com/jvm/fastest-threadsafe-singleton-jvm/ > Upgrade Jetty to 9.2.6 > ---------------------- > > Key: HBASE-12894 > URL: https://issues.apache.org/jira/browse/HBASE-12894 > Project: HBase > Issue Type: Improvement > Components: REST, UI > Affects Versions: 0.98.0 > Reporter: Rick Hallihan > Assignee: Guang Yang > Priority: Critical > Labels: MicrosoftSupport > Fix For: 2.0.0 > > Attachments: dependency_list_after, dependency_list_before, HBASE-12894_Jetty9_v0.patch, HBASE-12894_Jetty9_v10.patch, HBASE-12894_Jetty9_v1.patch, HBASE-12894_Jetty9_v1.patch, HBASE-12894_Jetty9_v2.patch, HBASE-12894_Jetty9_v3.patch, HBASE-12894_Jetty9_v4.patch, HBASE-12894_Jetty9_v5.patch, HBASE-12894_Jetty9_v6.patch, HBASE-12894_Jetty9_v7.patch, HBASE-12894_Jetty9_v8.patch, HBASE-12894.master.001.patch, HBASE-12894.master.002.patch, HBASE-12894.master.003.patch, HBASE-12894.master.004.patch, HBASE-12894.master.004.patch > > > The Jetty component that is used for the HBase Stargate REST endpoint is version 6.1.26 and is fairly outdated. We recently had a customer inquire about enabling cross-origin resource sharing (CORS) for the REST endpoint and found that this older version does not include the necessary filter or configuration options, highlighted at: http://wiki.eclipse.org/Jetty/Feature/Cross_Origin_Filter > The Jetty project has had significant updates through versions 7, 8 and 9, including a transition to be an Eclipse subproject, so updating to the latest version may be non-trivial. The last update to the Jetty component in https://issues.apache.org/jira/browse/HBASE-3377 was a minor version update and did not require significant work. This update will include a package namespace update so there will likely be a larger number of required changes. -- This message was sent by Atlassian JIRA (v6.3.4#6332)