@@ -0,0 +1,2467 @@
+/*%0A * Licensed to the University of California, Berkeley under one or more contributor license%0A * agreements. See the NOTICE file distributed with this work for additional information regarding%0A * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance with the License. You may obtain a%0A * copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the License%0A * is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express%0A * or implied. See the License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage tachyon.worker;%0A%0Aimport java.io.IOException;%0Aimport java.net.InetSocketAddress;%0Aimport java.util.Set;%0Aimport java.util.concurrent.ExecutorService;%0A%0Aimport org.apache.thrift.TException;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport tachyon.Constants;%0Aimport tachyon.MasterClient;%0Aimport tachyon.conf.TachyonConf;%0Aimport tachyon.thrift.FileSystemMasterService;%0Aimport tachyon.thrift.InvalidPathException;%0A%0A/**%0A * The FileSystemMaster client, for workers.%0A *%0A * Since thrift clients are not thread safe, this class is a wrapper to provide thread safety.%0A */%0Apublic final class FileSystemMasterClient extends MasterClient %7B%0A  private static final Logger LOG = LoggerFactory.getLogger(Constants.LOGGER_TYPE);%0A%0A  private FileSystemMasterService.Client mClient = null;%0A%0A  public FileSystemMasterClient(InetSocketAddress masterAddress, ExecutorService executorService,%0A      TachyonConf tachyonConf) %7B%0A    super(masterAddress, executorService, tachyonConf);%0A  %7D%0A%0A  @Override%0A  protected String getServiceName() %7B%0A    return Constants.FILE_SYSTEM_MASTER_SERVICE_NAME;%0A  %7D%0A%0A  @Override%0A  protected void afterConnect() %7B%0A    mClient = new FileSystemMasterService.Client(mProtocol);%0A  %7D%0A%0A  @Override%0A  protected void afterDisconnect() %7B%7D%0A%0A  public synchronized Set%3CLong%3E getPinList() throws IOException %7B%0A    while (!mIsClosed) %7B%0A      connect();%0A      try %7B%0A        return mClient.workerGetPinIdList();%0A      %7D catch (InvalidPathException e) %7B%0A        throw new IOException(e);%0A      %7D catch (TException e) %7B%0A        LOG.error(e.getMessage(), e);%0A        mConnected = false;%0A      %7D%0A    %7D%0A    throw new IOException(%22This connection has been closed.%22);%0A  %7D%0A%7D%0A

Add FS master client for workers