Search in sources :

Example 1 with VisibilityLabelsCache

use of org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache in project hbase by apache.

the class HBaseTestingUtil method waitLabelAvailable.

/**
 * Wait until labels is ready in VisibilityLabelsCache.
 */
public void waitLabelAvailable(long timeoutMillis, final String... labels) {
    final VisibilityLabelsCache labelsCache = VisibilityLabelsCache.get();
    waitFor(timeoutMillis, new Waiter.ExplainingPredicate<RuntimeException>() {

        @Override
        public boolean evaluate() {
            for (String label : labels) {
                if (labelsCache.getLabelOrdinal(label) == 0) {
                    return false;
                }
            }
            return true;
        }

        @Override
        public String explainFailure() {
            for (String label : labels) {
                if (labelsCache.getLabelOrdinal(label) == 0) {
                    return label + " is not available yet";
                }
            }
            return "";
        }
    });
}
Also used : VisibilityLabelsCache(org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache)

Example 2 with VisibilityLabelsCache

use of org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache in project hbase by apache.

the class HBaseTestingUtility method waitLabelAvailable.

/**
 * Wait until labels is ready in VisibilityLabelsCache.
 * @param timeoutMillis
 * @param labels
 */
public void waitLabelAvailable(long timeoutMillis, final String... labels) {
    final VisibilityLabelsCache labelsCache = VisibilityLabelsCache.get();
    waitFor(timeoutMillis, new Waiter.ExplainingPredicate<RuntimeException>() {

        @Override
        public boolean evaluate() {
            for (String label : labels) {
                if (labelsCache.getLabelOrdinal(label) == 0) {
                    return false;
                }
            }
            return true;
        }

        @Override
        public String explainFailure() {
            for (String label : labels) {
                if (labelsCache.getLabelOrdinal(label) == 0) {
                    return label + " is not available yet";
                }
            }
            return "";
        }
    });
}
Also used : VisibilityLabelsCache(org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache)

Aggregations

VisibilityLabelsCache (org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache)2