I don't know how to use null value in scala, and how to initialize the code in scala (because there is the constructor in java), I need an example helped me to understand.
public class HBaseTest {
private Configuration conf = null;
private Admin admin = null;
protected static Connection connection = null;
private static final HBaseTest HBaseTest = new HBaseTest();
public static final String ZK_PARAMS = "192.168.1.20:2181";
public static final String HBASE_ROOTDIR = "hdfs://192.168.1.20:8020/hbase";
/**
* initialization
*/
private HBaseTest() {
conf = new Configuration();
conf.set("hbase.zookeeper.quorum", ZK_PARAMS);
conf.set("hbase.rootdir", HBASE_ROOTDIR);
try {
admin = ConnectionFactory.createConnection(conf).getAdmin();
} catch (Exception e) {
e.printStackTrace();
}
}
public static HBaseTest getInstance() {
return HBaseTest;
}
}
protectedandstatic?protectedmembers at all?