accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Newton <eric.new...@gmail.com>
Subject Re: Is Connector thread-safe?
Date Wed, 21 Mar 2012 12:34:49 GMT
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 <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.  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
>

Mime
View raw message