hadoop - what difference of managed and unmanaged hconnection in hbase? -


when tried create htable instance in way.

configuration conf = hbaseconfiguration.create(); hconnection conn = hconnectionmanager.getconnection(conf); conn.gettable("table_name"); 

then got exception.

    @override     public htableinterface gettable(tablename tablename, executorservice pool) throws ioexception {       if (managed) {         throw new ioexception("the connection has unmanaged.");       }       return new htable(tablename, this, pool);     } 

so , wants know concrete reflection of managed , 'unmanaged' hconnection?

before call hconnectionmanager.getconnection have create connection using hconnectionmanager.createconnection passing earlier created hbaseconfiguration instance. hconnectionmanager.getconnection return connection exists. bit of hconnectionmanager javadoc how handle connection pool:

this class has static map of hconnection instances keyed by configuration; invocations of getconnection(configuration) that pass sameconfiguration instance returned samehconnection instance

in case, can create connection using hconnectionmanager.createconnection , use returned connection open htable

edit:

@ifiddddddbest, found javadocs hconnectionimplementation has description of managed flag(may understand):

@param managed if true, not full shutdown on close; i.e. cleanup of connection zk , shutdown of services; close down resources connection responsible , decrement usage counters. caller full cleanup. set when want have connection sharing going on -- reuse of zk connection, , cached region locations, established regionserver connections, etc. when connections shared, have reference counting going on , full cleanup when no more users of hconnectionimplementation instance.

in newer versions of hbase(>1.0), managed flag disappeared , connection management on client side,e.g. client responsible close , if this, close internal connections zk,to hbase master, etc, not decrease reference counter.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -