Example usage for org.apache.hadoop.hdfs.server.datanode DataNode createDataNode

List of usage examples for org.apache.hadoop.hdfs.server.datanode DataNode createDataNode

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.datanode DataNode createDataNode.

Prototype

@VisibleForTesting
public static DataNode createDataNode(String args[], Configuration conf) throws IOException 

Source Link

Document

Instantiate & Start a single datanode daemon and wait for it to finish.

Usage

From source file:com.griddynamics.jagger.storage.fs.hdfs.HDFSDatanodeServer.java

License:Open Source License

public void start() throws Exception {
    ThreadExecutorUtil.getInstance().addTask(new Runnable() {
        @Override/*from w ww . jav  a2s. c o m*/
        public void run() {
            log.info("Starting DataNode...");

            for (;;) {
                try {
                    if (startupProperties != null) {
                        dataNode = DataNode.createDataNode(null,
                                HadoopUtils.toConfiguration(startupProperties));
                        ready = true;
                        break;
                    } else
                        Thread.sleep(10000);
                } catch (Exception e) {
                    log.warn("Failed start DataNode: {}", e);
                    try {
                        Thread.sleep(10000);
                    } catch (InterruptedException e1) {
                        log.warn("Interrupted");
                        return;
                    }
                }
            }

            /*new Thread() {
            public void run() {
                dataNode.run();
            }
            }.start();*/

            log.info("DataNode started");
        }
    });
}

From source file:io.fabric8.hadoop.hdfs.DataNodeFactory.java

License:Apache License

@Override
protected DataNode doCreate(Dictionary properties) throws Exception {
    Configuration conf = new Configuration();
    for (Enumeration e = properties.keys(); e.hasMoreElements();) {
        Object key = e.nextElement();
        Object val = properties.get(key);
        conf.set(key.toString(), val.toString());
    }//w w w  . j  a v a2s.com
    DataNode dataNode = DataNode.createDataNode(null, conf);
    return dataNode;
}