当前位置: 首页>>代码示例>>Java>>正文


Java ZkSerializer类代码示例

本文整理汇总了Java中org.I0Itec.zkclient.serialize.ZkSerializer的典型用法代码示例。如果您正苦于以下问题:Java ZkSerializer类的具体用法?Java ZkSerializer怎么用?Java ZkSerializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ZkSerializer类属于org.I0Itec.zkclient.serialize包,在下文中一共展示了ZkSerializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
private void init() throws Exception {
        zkClient = new ZkClient(HOST.concat(":" + CLIENT_PORT), TIME_OUT_MILLISECOND);

        zkSerializer = new ZkSerializer() {
            /**
             * TODO{Benedict Jin}: kryo
             */
            @Override
            public byte[] serialize(Object data) throws ZkMarshallingError {
                return new byte[0];
            }

            @Override
            public Object deserialize(byte[] bytes) throws ZkMarshallingError {
                return null;
            }
        };
//        zkClient.setZkSerializer(zkSerializer);
    }
 
开发者ID:asdf2014,项目名称:yuzhouwan,代码行数:20,代码来源:ZkClientCRUD.java

示例2: ChainedPathZkSerializer

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
private ChainedPathZkSerializer(ZkSerializer defaultSerializer, List<ChainItem> items) {
  _items = items;
  // sort by longest paths first
  // if two items would match one would be prefix of the other
  // and the longest must be more specific
  Collections.sort(_items);
  _defaultSerializer = defaultSerializer;
}
 
开发者ID:apache,项目名称:helix,代码行数:9,代码来源:ChainedPathZkSerializer.java

示例3: ZkCacheBaseDataAccessor

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public ZkCacheBaseDataAccessor(String zkAddress, ZkSerializer serializer, String chrootPath,
    List<String> wtCachePaths, List<String> zkCachePaths, String monitorType, String monitorkey) {
  ZkClient.Builder zkClientBuilder = new ZkClient.Builder();
  zkClientBuilder.setZkServer(zkAddress).setSessionTimeout(ZkClient.DEFAULT_SESSION_TIMEOUT)
      .setConnectionTimeout(ZkClient.DEFAULT_CONNECTION_TIMEOUT).setZkSerializer(serializer)
      .setMonitorType(monitorType).setMonitorKey(monitorkey);
  _zkclient = zkClientBuilder.build();

  _zkclient.waitUntilConnected(ZkClient.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);
  _baseAccessor = new ZkBaseDataAccessor<>(_zkclient);

  if (chrootPath == null || chrootPath.equals("/")) {
    _chrootPath = null;
  } else {
    PathUtils.validatePath(chrootPath);
    _chrootPath = chrootPath;
  }

  _wtCachePaths = wtCachePaths;
  _zkCachePaths = zkCachePaths;

  // TODO: need to make sure no overlap between wtCachePaths and zkCachePaths
  // TreeMap key is ordered by key string length, so more general (i.e. short) prefix
  // comes first
  _cacheMap = new TreeMap<>(new Comparator<String>() {
    @Override
    public int compare(String o1, String o2) {
      int len1 = o1.split("/").length;
      int len2 = o2.split("/").length;
      return len1 - len2;
    }
  });

  start();
}
 
开发者ID:apache,项目名称:helix,代码行数:36,代码来源:ZkCacheBaseDataAccessor.java

示例4: ZKDumper

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public ZKDumper(String zkAddress) {
  client = new ZkClient(zkAddress, ZkClient.DEFAULT_CONNECTION_TIMEOUT);

  ZkSerializer zkSerializer = new ByteArraySerializer();
  client.setZkSerializer(zkSerializer);
  filter = new FilenameFilter() {

    @Override
    public boolean accept(File dir, String name) {
      return !name.startsWith(".");
    }
  };
}
 
开发者ID:apache,项目名称:helix,代码行数:14,代码来源:ZKDumper.java

示例5: before

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
@Override
protected void before() throws Throwable {
    tempDir.create();

    zkServer = new TestingServer();

    zkClient = new ZkClient("localhost:" + zkServer.getPort(), 20000, 20000, new ZkSerializer() {
        @Override
        public byte[] serialize(Object data) throws ZkMarshallingError {
            try {
                return ((String)data).getBytes("UTF-8");
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }

        @Override
        public Object deserialize(byte[] bytes) throws ZkMarshallingError {
            if (bytes == null)
                return null;
            try {
                return new String(bytes, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }
    });
}
 
开发者ID:Netflix,项目名称:suro,代码行数:29,代码来源:ZkExternalResource.java

示例6: ZkClientx

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public ZkClientx(String zkServers, int sessionTimeout, int connectionTimeout, ZkSerializer zkSerializer){
    this(new ZooKeeperx(zkServers, sessionTimeout), connectionTimeout, zkSerializer);
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:4,代码来源:ZkClientx.java

示例7: setZkSerializer

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public void setZkSerializer(ZkSerializer zkSerializer) {
    _zkSerializer = zkSerializer;
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:4,代码来源:ZkClientx.java

示例8: BasicZkSerializer

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public BasicZkSerializer(ZkSerializer delegate) {
  _delegate = delegate;
}
 
开发者ID:apache,项目名称:helix,代码行数:4,代码来源:BasicZkSerializer.java

示例9: Builder

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
private Builder(ZkSerializer defaultSerializer) {
  _defaultSerializer = defaultSerializer;
}
 
开发者ID:apache,项目名称:helix,代码行数:4,代码来源:ChainedPathZkSerializer.java

示例10: ChainItem

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
ChainItem(String path, ZkSerializer serializer) {
  _path = path;
  _serializer = serializer;
}
 
开发者ID:apache,项目名称:helix,代码行数:5,代码来源:ChainedPathZkSerializer.java

示例11: setZkSerializer

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public void setZkSerializer(ZkSerializer zkSerializer) {
  _pathBasedZkSerializer = new BasicZkSerializer(zkSerializer);
}
 
开发者ID:apache,项目名称:helix,代码行数:4,代码来源:ZkClient.java

示例12: ZkClient

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public ZkClient(IZkConnection connection, int connectionTimeout, ZkSerializer zkSerializer) {
  this(connection, connectionTimeout, new BasicZkSerializer(zkSerializer));
}
 
开发者ID:apache,项目名称:helix,代码行数:4,代码来源:ZkClient.java

示例13: setZkSerializer

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public Builder setZkSerializer(ZkSerializer zkSerializer) {
  this._zkSerializer = new BasicZkSerializer(zkSerializer);
  return this;
}
 
开发者ID:apache,项目名称:helix,代码行数:5,代码来源:ZkClient.java

示例14: serialize

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public byte[] serialize(ZkSerializer serializer) {
  return serializer.serialize(_record);
}
 
开发者ID:apache,项目名称:helix,代码行数:4,代码来源:HelixProperty.java

示例15: ZkHelixPropertyStore

import org.I0Itec.zkclient.serialize.ZkSerializer; //导入依赖的package包/类
public ZkHelixPropertyStore(String zkAddress, ZkSerializer serializer, String chrootPath,
    List<String> zkCachePaths) {
  super(zkAddress, serializer, chrootPath, null, zkCachePaths, MONITOR_TYPE, chrootPath);
}
 
开发者ID:apache,项目名称:helix,代码行数:5,代码来源:ZkHelixPropertyStore.java


注:本文中的org.I0Itec.zkclient.serialize.ZkSerializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。