org.apache.storm.utils.Utils.thriftSerialize()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中org.apache.storm.utils.Utils.thriftSerialize()方法的一些代码示例,展示了Utils.thriftSerialize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.thriftSerialize()方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:thriftSerialize

Utils.thriftSerialize介绍

暂无

代码示例

代码示例来源:origin: apache/storm

public static byte[] thriftSerialize(TBase t) {
  return Utils.thriftSerialize(t);
}

代码示例来源:origin: apache/storm

byte serialized[] = Utils.thriftSerialize(m);
ByteBuf ret = alloc.ioBuffer(serialized.length + 4);

代码示例来源:origin: apache/storm

public void writeMetadata(String key, SettableBlobMeta meta)
    throws AuthorizationException, KeyNotFoundException {
  BlobStoreFileOutputStream mOut = null;
  try {
    BlobStoreFile hdfsFile = hbs.write(META_PREFIX + key, false);
    hdfsFile.setMetadata(meta);
    mOut = new BlobStoreFileOutputStream(hdfsFile);
    mOut.write(Utils.thriftSerialize(meta));
    mOut.close();
    mOut = null;
  } catch (IOException exp) {
    throw new RuntimeException(exp);
  } finally {
    if (mOut != null) {
      try {
        mOut.cancel();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: apache/storm

try {
  mOut = new BlobStoreFileOutputStream(fbs.write(META_PREFIX + key, true));
  mOut.write(Utils.thriftSerialize(meta));
  mOut.close();
  mOut = null;

代码示例来源:origin: apache/storm

@Override
public void setBlobMeta(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyNotFoundException {
  validateKey(key);
  checkForBlobOrDownload(key);
  _aclHandler.normalizeSettableBlobMeta(key, meta, who, ADMIN);
  BlobStoreAclHandler.validateSettableACLs(key, meta.get_acl());
  SettableBlobMeta orig = getStoredBlobMeta(key);
  _aclHandler.hasPermissions(orig.get_acl(), ADMIN, who, key);
  BlobStoreFileOutputStream mOut = null;
  try {
    mOut = new BlobStoreFileOutputStream(fbs.write(META_PREFIX + key, false));
    mOut.write(Utils.thriftSerialize(meta));
    mOut.close();
    mOut = null;
  } catch (IOException e) {
    throw new RuntimeException(e);
  } finally {
    if (mOut != null) {
      try {
        mOut.cancel();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: apache/storm

byte[] serializedState = Utils.gzip(Utils.thriftSerialize(st));

代码示例来源:origin: apache/storm

st.set_bolts(new HashMap<>());
st.set_state_spouts(new HashMap<>());
byte[] serializedState = Utils.gzip(Utils.thriftSerialize(st));

代码示例来源:origin: apache/storm

byte[] serializedState = Utils.gzip(Utils.thriftSerialize(st));

代码示例来源:origin: apache/storm

metaFile.setMetadata(meta);
mOut = new BlobStoreFileOutputStream(metaFile);
mOut.write(Utils.thriftSerialize(meta));
mOut.close();
mOut = null;

代码示例来源:origin: org.apache.storm/storm-core

public static byte[] thriftSerialize(TBase t) {
  return Utils.thriftSerialize(t);
}

代码示例来源:origin: org.apache.storm/storm-core

byte serialized[] = Utils.thriftSerialize(m);
ChannelBuffer ret = ChannelBuffers.directBuffer(serialized.length + 4);

代码示例来源:origin: org.apache.storm/storm-hdfs

public void writeMetadata(String key, SettableBlobMeta meta)
    throws AuthorizationException, KeyNotFoundException {
  BlobStoreFileOutputStream mOut = null;
  try {
    BlobStoreFile hdfsFile = hbs.write(META_PREFIX + key, false);
    hdfsFile.setMetadata(meta);
    mOut = new BlobStoreFileOutputStream(hdfsFile);
    mOut.write(Utils.thriftSerialize(meta));
    mOut.close();
    mOut = null;
  } catch (IOException exp) {
    throw new RuntimeException(exp);
  } finally {
    if (mOut != null) {
      try {
        mOut.cancel();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
public AtomicOutputStream createBlob(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyAlreadyExistsException {
  LOG.debug("Creating Blob for key {}", key);
  validateKey(key);
  _aclHandler.normalizeSettableBlobMeta(key, meta, who, allPermissions);
  BlobStoreAclHandler.validateSettableACLs(key, meta.get_acl());
  _aclHandler.hasPermissions(meta.get_acl(), allPermissions, who, key);
  if (fbs.exists(DATA_PREFIX+key)) {
    throw new KeyAlreadyExistsException(key);
  }
  BlobStoreFileOutputStream mOut = null;
  try {
    mOut = new BlobStoreFileOutputStream(fbs.write(META_PREFIX+key, true));
    mOut.write(Utils.thriftSerialize(meta));
    mOut.close();
    mOut = null;
    return new BlobStoreFileOutputStream(fbs.write(DATA_PREFIX+key, true));
  } catch (IOException e) {
    throw new RuntimeException(e);
  } finally {
    if (mOut != null) {
      try {
        mOut.cancel();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
public void setBlobMeta(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyNotFoundException {
  validateKey(key);
  checkForBlobOrDownload(key);
  _aclHandler.normalizeSettableBlobMeta(key, meta, who, ADMIN);
  BlobStoreAclHandler.validateSettableACLs(key, meta.get_acl());
  SettableBlobMeta orig = getStoredBlobMeta(key);
  _aclHandler.hasPermissions(orig.get_acl(), ADMIN, who, key);
  BlobStoreFileOutputStream mOut = null;
  try {
    mOut = new BlobStoreFileOutputStream(fbs.write(META_PREFIX+key, false));
    mOut.write(Utils.thriftSerialize(meta));
    mOut.close();
    mOut = null;
  } catch (IOException e) {
    throw new RuntimeException(e);
  } finally {
    if (mOut != null) {
      try {
        mOut.cancel();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: org.apache.storm/storm-hdfs

metaFile.setMetadata(meta);
mOut = new BlobStoreFileOutputStream(metaFile);
mOut.write(Utils.thriftSerialize(meta));
mOut.close();
mOut = null;

相关文章

Utils类方法