Java Code Examples for org.apache.hadoop.hbase.util.Writables#getBytes()

The following examples show how to use org.apache.hadoop.hbase.util.Writables#getBytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZKSecretWatcher.java    From hbase with Apache License 2.0 6 votes vote down vote up
public void addKeyToZK(AuthenticationKey key) {
  String keyZNode = getKeyNode(key.getKeyId());
  try {
    byte[] keyData = Writables.getBytes(key);
    // TODO: is there any point in retrying beyond what ZK client does?
    ZKUtil.createSetData(watcher, keyZNode, keyData);
  } catch (KeeperException ke) {
    LOG.error(HBaseMarkers.FATAL, "Unable to synchronize master key "+key.getKeyId()+
        " to znode "+keyZNode, ke);
    watcher.abort("Unable to synchronize secret key "+
        key.getKeyId()+" in zookeeper", ke);
  } catch (IOException ioe) {
    // this can only happen from an error serializing the key
    watcher.abort("Failed serializing key "+key.getKeyId(), ioe);
  }
}
 
Example 2
Source File: ZKSecretWatcher.java    From hbase with Apache License 2.0 6 votes vote down vote up
public void updateKeyInZK(AuthenticationKey key) {
  String keyZNode = getKeyNode(key.getKeyId());
  try {
    byte[] keyData = Writables.getBytes(key);
    try {
      ZKUtil.updateExistingNodeData(watcher, keyZNode, keyData, -1);
    } catch (KeeperException.NoNodeException ne) {
      // node was somehow removed, try adding it back
      ZKUtil.createSetData(watcher, keyZNode, keyData);
    }
  } catch (KeeperException ke) {
    LOG.error(HBaseMarkers.FATAL, "Unable to update master key "+key.getKeyId()+
        " in znode "+keyZNode);
    watcher.abort("Unable to synchronize secret key "+
        key.getKeyId()+" in zookeeper", ke);
  } catch (IOException ioe) {
    // this can only happen from an error serializing the key
    watcher.abort("Failed serializing key "+key.getKeyId(), ioe);
  }
}
 
Example 3
Source File: ColumnProjectionFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] toByteArray() throws IOException {
    return Writables.getBytes(this);
}
 
Example 4
Source File: BooleanExpressionFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] toByteArray() throws IOException {
    return Writables.getBytes(this);
}
 
Example 5
Source File: SkipScanFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] toByteArray() throws IOException {
    return Writables.getBytes(this);
}
 
Example 6
Source File: ColumnProjectionFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] toByteArray() throws IOException {
    return Writables.getBytes(this);
}
 
Example 7
Source File: BooleanExpressionFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] toByteArray() throws IOException {
    return Writables.getBytes(this);
}
 
Example 8
Source File: EncodedQualifiersColumnProjectionFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] toByteArray() throws IOException {
    return Writables.getBytes(this);
}
 
Example 9
Source File: SkipScanFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] toByteArray() throws IOException {
    return Writables.getBytes(this);
}
 
Example 10
Source File: DistinctPrefixFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] toByteArray() throws IOException {
    return Writables.getBytes(this);
}