Search in sources :

Example 1 with ProtectACLCreateModePathAndBytesable

use of org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable in project jstorm by alibaba.

the class ZkState method writeBytes.

public void writeBytes(String path, byte[] bytes) {
    try {
        if (_curator.checkExists().forPath(path) == null) {
            CreateBuilder builder = _curator.create();
            ProtectACLCreateModePathAndBytesable<String> createAble = (ProtectACLCreateModePathAndBytesable<String>) builder.creatingParentsIfNeeded();
            createAble.withMode(CreateMode.PERSISTENT).forPath(path, bytes);
        } else {
            _curator.setData().forPath(path, bytes);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : ProtectACLCreateModePathAndBytesable(org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable) CreateBuilder(org.apache.curator.framework.api.CreateBuilder)

Aggregations

CreateBuilder (org.apache.curator.framework.api.CreateBuilder)1 ProtectACLCreateModePathAndBytesable (org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable)1