[ 
https://issues.apache.org/jira/browse/HBASE-14876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15283576#comment-15283576
 ] 

Daniel Vimont commented on HBASE-14876:
---------------------------------------

The JIRA "spam lockdown" appears to be over, so I can finally post this...

Yes, definitely the more comprehensive solution would appear to be -- setting 
those port values to -1 ("grab a random port") in the constructor of 
HBaseTestingUtility.

Unless someone can think of a reason not to, I'll create a new JIRA entry and 
add something like the following lines of code to the end of the main 
HBaseTestingUtility constructor method:
{code}
    this.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, -1);
    this.getConfiguration().setInt(HConstants.REGIONSERVER_PORT, -1);
{code}
The only drawback I see to these two lines of code is that they do not allow 
the user to explicitly define a specific port of their choosing for the 
MASTER_INFO_PORT and REGIONSERVER_PORT values. To allow for such user-defined 
overrides, something like this could be added instead:
{code}
    Configuration conf = this.getConfiguration();
    if (conf.getInt(HConstants.MASTER_INFO_PORT, 
HConstants.DEFAULT_MASTER_INFOPORT)
            == HConstants.DEFAULT_MASTER_INFOPORT) {
      conf.setInt(HConstants.MASTER_INFO_PORT, -1);
    }
    if (conf.getInt(HConstants.REGIONSERVER_PORT, 
HConstants.DEFAULT_REGIONSERVER_PORT)
            == HConstants.DEFAULT_REGIONSERVER_PORT) {
      conf.setInt(HConstants.REGIONSERVER_PORT, -1);
    }
{code}
I tend to think this second snippet represents the way to go.

> Provide maven archetypes
> ------------------------
>
>                 Key: HBASE-14876
>                 URL: https://issues.apache.org/jira/browse/HBASE-14876
>             Project: HBase
>          Issue Type: New Feature
>          Components: build, Usability
>    Affects Versions: 2.0.0
>            Reporter: Nick Dimiduk
>            Assignee: Daniel Vimont
>              Labels: beginner, maven
>         Attachments: HBASE-14876-v2.patch, HBASE-14876.patch, 
> archetype_prototype.zip, archetype_prototype02.zip, 
> archetype_shaded_prototype01.zip
>
>
> To help onboard new users, we should provide maven archetypes for hbase 
> client applications. Off the top of my head, we should have templates for
>  - hbase client application with all dependencies
>  - hbase client application using client-shaded jar
>  - mapreduce application with hbase as input and output (ie, copy table)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to