All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.linkedin.zookeeper.tracker.ZKStringDataReader Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2010-2010 LinkedIn, Inc
 *
 * Licensed 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 org.linkedin.zookeeper.tracker;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
import org.linkedin.util.lang.LangUtils;
import org.linkedin.zookeeper.client.IZKClient;
import org.linkedin.zookeeper.client.ZKData;

/**
 * @author [email protected]
 *
 */
public class ZKStringDataReader implements ZKDataReader
{
  public static final ZKStringDataReader INSTANCE = new ZKStringDataReader();

  public static ZKStringDataReader instance()
  {
    return INSTANCE;
  }

  @Override
  public ZKData readData(IZKClient zkClient, String path, Watcher watcher)
    throws InterruptedException, KeeperException
  {
    return zkClient.getZKStringData(path, watcher);
  }

  /**
   * Compare 2 data equality
   *
   * @return true if equal (in the {@link Object#equals(Object)} definition)
   */
  @Override
  public boolean isEqual(String data1, String data2)
  {
    return LangUtils.isEqual(data1, data2);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy