Multiples Hadoop FileSystem instances

后端 未结 2 1646
长情又很酷
长情又很酷 2021-02-06 13:12

I have a class (I removes try/catch for readability):

public class HadoopFileSystem {

    private FileSystem m_fileSystem = null;

    public HadoopFileSystem()         


        
2条回答
  •  花落未央
    2021-02-06 13:35

    You are creating an object based on a configuration which is hard-coded. This basically means that you're creating 2 identical objects. Because these objects are identical, the JVM will reference to the same object. So h1 and h2 are referencing the same object.

    The reason for this is because you're getting an existing instance of an object based on a configuration file. If the configuration is different for h1 and h2, it will not be the same instance anymore.

提交回复
热议问题