title: Java concurrency topic: publication of objects or its internal state
body: <p>I'm reading the code base of a project, and here's some code I can't under stand:</p>
  
  <pre><code>protected BaseApiCommand(String apiName, ApiParams params, boolean isGetRequest) {
      this.apiName = apiName;
      this.apiParams = params;
      this.isGet = isGetRequest;
      if (apiParams == null) {
          apiParams = new ApiParams();
      }
  }
  
  public static BaseApiCommand createCommand(String apiName, boolean isGet, ApiParams params) {
      return new BaseApiCommand(apiName, params, isGet);
  }
  </code></pre>
  
  <p>I know it's about publication, but I just can't understand why it's unsafe otherwise to expose the constructor directly. Can anyone explain it in detail ?</p>