public static boolean delQuota(ZooKeeper zk, String path, boolean bytes,
            boolean numNodes) throws KeeperException, IOException,
            InterruptedException {
        String parentPath = Quotas.quotaZookeeper + path;
        String quotaPath = Quotas.quotaZookeeper + path + "/"
                + Quotas.limitNode;
        if (zk.exists(quotaPath, false) == null) {
            System.out.println("Quota does not exist for " + path);
            return true;
        }
        byte[] data = null;
        try {
            data = zk.getData(quotaPath, false, new Stat());
        } catch (KeeperException.NoNodeException ne) {
            System.err.println("quota does not exist for " + path);
            return true;
        }
        StatsTrack strack = new StatsTrack(new String(data));
        if (bytes && !numNodes) {
            strack.setBytes(-1L);
            zk.setData(quotaPath, strack.toString().getBytes(), -1);
        } else if (!bytes && numNodes) {
            strack.setCount(-1);
            zk.setData(quotaPath, strack.toString().getBytes(), -1);
        } else if (bytes && numNodes) {
            // delete till you can find a node with more than
            // one child
            List<String> children = zk.getChildren(parentPath, false);
            // / delete the direct children first
            for (String child : children) {
                zk.delete(parentPath + "/" + child, -1);
            }
            // cut the tree till their is more than one child
            trimProcQuotas(zk, parentPath);
        }
        return true;
    }
public static boolean delQuota ( ZooKeeper zk , String path , boolean bytes , boolean numNodes ) throws KeeperException , IOException , InterruptedException { String parentPath = Quotas . quotaZookeeper + path ; String quotaPath = Quotas . quotaZookeeper + path + "/" + Quotas . limitNode ; if ( zk . exists ( quotaPath , false ) == null ) { System . out . println ( "Quota does not exist for " + path ) ; return true ; } byte [ ] data = null ; try { data = zk . getData ( quotaPath , false , new Stat ( ) ) ; } catch ( KeeperException . NoNodeException ne ) { System . err . println ( "quota does not exist for " + path ) ; return true ; } StatsTrack strack = new StatsTrack ( new String ( data ) ) ; if ( bytes && ! numNodes ) { strack . setBytes ( - 1L ) ; zk . setData ( quotaPath , strack . toString ( ) . getBytes ( ) , - 1 ) ; } else if ( ! bytes && numNodes ) { strack . setCount ( - 1 ) ; zk . setData ( quotaPath , strack . toString ( ) . getBytes ( ) , - 1 ) ; } else if ( bytes && numNodes ) { List < String > children = zk . getChildren ( parentPath , false ) ; for ( String child : children ) { zk . delete ( parentPath + "/" + child , - 1 ) ; } trimProcQuotas ( zk , parentPath ) ; } return true ; }
this method deletes quota for a node.

@param zk
the zookeeper client
@param path
the path to delete quota for
@param bytes
true if number of bytes needs to be unset
@param numNodes
true if number of nodes needs to be unset
@return true if quota deletion is successful
@throws KeeperException
@throws IOException
@throws InterruptedException