Search in sources :

Example 1 with SecureStore

use of com.continuuity.weave.api.SecureStore in project weave by continuuity.

the class YarnWeaveRunnerService method updateSecureStores.

private void updateSecureStores(Table<String, RunId, SecureStore> secureStores) {
    for (Table.Cell<String, RunId, SecureStore> cell : secureStores.cellSet()) {
        Object store = cell.getValue().getStore();
        if (!(store instanceof Credentials)) {
            LOG.warn("Only Hadoop Credentials is supported. Ignore update for {}.", cell);
            continue;
        }
        Credentials credentials = (Credentials) store;
        if (credentials.getAllTokens().isEmpty()) {
            // Nothing to update.
            continue;
        }
        try {
            updateCredentials(cell.getRowKey(), cell.getColumnKey(), credentials);
            synchronized (YarnWeaveRunnerService.this) {
                // Notify the application for secure store updates if it is still running.
                YarnWeaveController controller = controllers.get(cell.getRowKey(), cell.getColumnKey());
                if (controller != null) {
                    controller.secureStoreUpdated();
                }
            }
        } catch (Throwable t) {
            LOG.warn("Failed to update secure store for {}.", cell, t);
        }
    }
}
Also used : HashBasedTable(com.google.common.collect.HashBasedTable) ImmutableTable(com.google.common.collect.ImmutableTable) Table(com.google.common.collect.Table) JsonObject(com.google.gson.JsonObject) RunId(com.continuuity.weave.api.RunId) SecureStore(com.continuuity.weave.api.SecureStore) Credentials(org.apache.hadoop.security.Credentials)

Aggregations

RunId (com.continuuity.weave.api.RunId)1 SecureStore (com.continuuity.weave.api.SecureStore)1 HashBasedTable (com.google.common.collect.HashBasedTable)1 ImmutableTable (com.google.common.collect.ImmutableTable)1 Table (com.google.common.collect.Table)1 JsonObject (com.google.gson.JsonObject)1 Credentials (org.apache.hadoop.security.Credentials)1