Return-Path: X-Original-To: apmail-incubator-accumulo-user-archive@minotaur.apache.org Delivered-To: apmail-incubator-accumulo-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8A6C298FC for ; Wed, 21 Mar 2012 12:35:20 +0000 (UTC) Received: (qmail 59312 invoked by uid 500); 21 Mar 2012 12:35:20 -0000 Delivered-To: apmail-incubator-accumulo-user-archive@incubator.apache.org Received: (qmail 59251 invoked by uid 500); 21 Mar 2012 12:35:19 -0000 Mailing-List: contact accumulo-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: accumulo-user@incubator.apache.org Delivered-To: mailing list accumulo-user@incubator.apache.org Received: (qmail 59199 invoked by uid 99); 21 Mar 2012 12:35:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Mar 2012 12:35:17 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of eric.newton@gmail.com designates 209.85.210.175 as permitted sender) Received: from [209.85.210.175] (HELO mail-iy0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Mar 2012 12:35:10 +0000 Received: by iaag37 with SMTP id g37so1553218iaa.6 for ; Wed, 21 Mar 2012 05:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=C+HwCtAX52VDBC08PFu+I3kkaKAQH4iB8e4kcPDgjhM=; b=D02DSZpKyTpm2GdEd+dC3XBL0syZ7P7ggwm9k1o4kioAzNjlqg/iFLwmNsx9PLVzcG xlRvx84hK+DUUEewQISEzOe6fD0UnBd0Z100tfz/76DgVfERDrWchOj8rdrAf0zT5UIX iZYLtHj9XVe5FOo1sUJ5OQPnK6A/iJT7h3iQJ/0HXpJMCKC0BEgGLbd35x+3EwcnHtKj MQ0N2J0PnjSustVWtJItgFwLsVWD/xAYMc0ROpjdmb3BKzdI7Lm9Ql7JS1SNlAS2FIjr ztfWVExrlLRYa09d8M+MFLrewZ1RuFwgclkcG+tNqm4Fe8b6LTYMsaxt5mcKA85PnOvc WZsw== MIME-Version: 1.0 Received: by 10.50.183.137 with SMTP id em9mr13206679igc.58.1332333289590; Wed, 21 Mar 2012 05:34:49 -0700 (PDT) Received: by 10.50.181.202 with HTTP; Wed, 21 Mar 2012 05:34:49 -0700 (PDT) In-Reply-To: <1807-1332288136-348619@sneakemail.com> References: <1807-1332288136-348619@sneakemail.com> Date: Wed, 21 Mar 2012 08:34:49 -0400 Message-ID: Subject: Re: Is Connector thread-safe? From: Eric Newton To: accumulo-user@incubator.apache.org Cc: qn2b6c2b9w@snkmail.com Content-Type: multipart/alternative; boundary=14dae93408f772cff904bbc004a2 X-Virus-Checked: Checked by ClamAV on apache.org --14dae93408f772cff904bbc004a2 Content-Type: text/plain; charset=ISO-8859-1 Yes, Connector is thread-safe, the new objects it creates are not. BTW, it is preferable to use instance to create Connectors: Instance i = new ZooKeeperInstance(instanceName, zookeepers); Connector c = i.getConnector(userName, password.getBytes()); -Eric On Tue, Mar 20, 2012 at 8:02 PM, Sukant Hajra wrote: > Hi, > > I realized that I should probably double check what Cloudbase/Accumulo > abstractions are thread-safe, and which are not. > > We'd like to avoid creating resources redundantly. Consider the following > builder code: > > public static Connector newConnector(String instanceName, > String zookeepers, > String userName, > String password) throws > CBSecurityException, > > CBException { > return new ConnectorImpl( > new ZooKeeperInstance(instanceName, zookeepers), > userName, > password.getBytes()); > } > > Based on the parameter list, this seems like Connector might be a > thread-safe > object. . . and that the Scanners, Writers, and Deleters created by it > are the > non-threadsafe objects to be used in isolated contexts. > > Is this correct? By the way, if I missed something in the documentation, > please point me to it, I'm eager to read more documentation on this > project. > > Also, I opted not to the subscribe to the list just yet, so please cc me > on any > responses (I'll try to check the archives for responses too). > > -Sukant > --14dae93408f772cff904bbc004a2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Yes, Connector is thread-safe, th= e new objects it creates are not.

BTW, it is preferable to use instance to create Connectors:=

Instance i =3D new=A0ZooKeep= erInstance(instanceName, zookeepers= );
Connector c =3D i.getConnector(userName,=A0password.getBytes());

-Eric


On Tue, Mar= 20, 2012 at 8:02 PM, Sukant Hajra <qn2b6c2b9w@snkmail.com> wrote:
Hi,

I realized that I should probably double check what Cloudbase/Accumulo
abstractions are thread-safe, and which are not.

We'd like to avoid creating resources redundantly. =A0Consider the foll= owing
builder code:

=A0 =A0public static Connector newConnector(String instanceName,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 String zookeepers,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 String userName,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 String password) throws CBSecurityException,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 CBException {
=A0 =A0 =A0 =A0return new ConnectorImpl(
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0new ZooKeeperInstance(instanceName, zookeep= ers),
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0userName,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0password.getBytes());
=A0 =A0}

Based on the parameter list, this seems like Connector might be a thread-sa= fe
object. . . =A0and that the Scanners, Writers, and Deleters created by it a= re the
non-threadsafe objects to be used in isolated contexts.

Is this correct? =A0By the way, if I missed something in the documentation,=
please point me to it, I'm eager to read more documentation on this pro= ject.

Also, I opted not to the subscribe to the list just yet, so please cc me on= any
responses (I'll try to check the archives for responses too).

-Sukant

--14dae93408f772cff904bbc004a2--