Best practice handling hbase join and tables in java?

I am using hbase-client 1.2.3, I saw that there is a comment in the Connection.getTable () method:

  • Get a view of the table to access the table.

  • The returned table is not thread safe; a new instance must be created for each stream used.

  • This is an easy operation, join or cache returned table

  • not required and not required.

So, I'm starting to wonder what is the best way to handle a join and a table?

For example, I have a main class, several threads will start, call A, B, C ...

Now I call "Connection connection = ConnectionFactory.createConnection ();" in the main method and pass the connection to each thread as a parameter for each thread. And then initialize the Table class in each thread.

I want to know is this the best way? Could this cause some threads or efficiency or any other problems?

+6
source share

Source: https://habr.com/ru/post/1016740/


All Articles