Search in sources :

Example 1 with CollectionUtils

use of org.apache.hbase.thirdparty.org.apache.commons.collections4.CollectionUtils in project azure-tools-for-java by Microsoft.

the class FunctionDeploymentState method listFunctions.

// todo: Move to toolkit lib as shared task
private List<FunctionEntity> listFunctions(final IFunctionApp functionApp) {
    final int[] count = { 0 };
    final IAzureMessager azureMessager = AzureMessager.getMessager();
    return Mono.fromCallable(() -> {
        final AzureString message = count[0]++ == 0 ? AzureString.fromString(SYNCING_TRIGGERS) : AzureString.format(SYNCING_TRIGGERS_WITH_RETRY, count[0], LIST_TRIGGERS_MAX_RETRY);
        azureMessager.info(message);
        return Optional.ofNullable(functionApp.listFunctions(true)).filter(CollectionUtils::isNotEmpty).orElseThrow(() -> new AzureToolkitRuntimeException(NO_TRIGGERS_FOUNDED));
    }).subscribeOn(Schedulers.boundedElastic()).retryWhen(Retry.fixedDelay(LIST_TRIGGERS_MAX_RETRY - 1, Duration.ofSeconds(LIST_TRIGGERS_RETRY_PERIOD_IN_SECONDS))).block();
}
Also used : IAzureMessager(com.microsoft.azure.toolkit.lib.common.messager.IAzureMessager) CollectionUtils(org.apache.commons.collections4.CollectionUtils) AzureToolkitRuntimeException(com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString)

Aggregations

AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)1 AzureToolkitRuntimeException (com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException)1 IAzureMessager (com.microsoft.azure.toolkit.lib.common.messager.IAzureMessager)1 CollectionUtils (org.apache.commons.collections4.CollectionUtils)1