/*
 * Licensed to the University of California, Berkeley under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package tachyon.master;

import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.google.common.base.Supplier;

import tachyon.client.file.TachyonFileSystem;
import tachyon.client.file.TachyonFileSystem.TachyonFileSystemFactory;
import tachyon.conf.TachyonConf;

/**
 * Keeps a collection of all clients ({@link tachyon.client.TachyonFS}) returned. The main reason
 * for this is to build cleanup clients.
 */
public final class ClientPool implements Closeable {
  private final List<TachyonFileSystem> mClients = Collections
      .synchronizedList(new ArrayList<TachyonFileSystem>());

  ClientPool(Supplier<String> uriSupplier) {
  }

  /**
   * Returns a {@link tachyon.client.TachyonFS} client. This client does not need to be closed
   * directly, but can be closed by calling {@link #close()} on this object.
   *
   * @param tachyonConf Tachyon configuration
   * @return a TachyonFS client
   * @throws IOException when the operation fails
   */
  public TachyonFileSystem getClient(TachyonConf tachyonConf) throws IOException {
    final TachyonFileSystem fs = TachyonFileSystemFactory.get();
    mClients.add(fs);
    return fs;
  }

  @Override
  public void close() throws IOException {
    synchronized (mClients) {
      mClients.clear();
    }
  }
}

@@ -1203,24 +1203,29 @@
 .client.
+file.
 TachyonF
 S%7D) retu
@@ -1216,17 +1216,25 @@
 TachyonF
-S
+ileSystem
 %7D) retur
@@ -1241,16 +1241,19 @@
 ned. The
+%0A *
  main re
@@ -1256,19 +1256,16 @@
 n reason
-%0A *
  for thi
@@ -1402,16 +1402,22 @@
 lients =
+%0A     
  Collect
@@ -1420,23 +1420,16 @@
 lections
-%0A      
 .synchro
@@ -1520,19 +1520,16 @@
 plier) %7B
-%0A  
 %7D%0A%0A  /**
@@ -1566,24 +1566,29 @@
 .client.
+file.
 TachyonF
 S%7D clien
@@ -1579,17 +1579,25 @@
 TachyonF
-S
+ileSystem
 %7D client
@@ -1633,20 +1633,20 @@
 o be
+%0A   *
  closed
-%0A   *
  dir

Fix javadoc and formatting