當前位置: 首頁>>代碼示例>>Java>>正文


Java Completable.fromAction方法代碼示例

本文整理匯總了Java中io.reactivex.Completable.fromAction方法的典型用法代碼示例。如果您正苦於以下問題:Java Completable.fromAction方法的具體用法?Java Completable.fromAction怎麽用?Java Completable.fromAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.reactivex.Completable的用法示例。


在下文中一共展示了Completable.fromAction方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: remove

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable remove(K... keys) {
    return Completable.fromAction(() -> {
        try (Jedis jedis = pool.getResource()) {
            String[] fullKeys = new String[keys.length];

            for (int i = 0; i < keys.length; i++) {
                fullKeys[i] = buildKey(keys[i]);
            }

            jedis.del(fullKeys);
        } catch (Exception e) {
            LOG.error("Could not write to Redis", e);

            throw new ServiceException(HttpStatus.SC_INTERNAL_SERVER_ERROR, e);
        }
    });
}
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:19,代碼來源:RedisDaoImpl.java

示例2: storeToMap

import io.reactivex.Completable; //導入方法依賴的package包/類
private Completable storeToMap(final int orderID,
                               final IOrder order) {
    return Completable.fromAction(() -> {
        orderByID.put(orderID, order);
        logger.debug("Stored Zorro order with ID " + orderID + " to repository.");
    });
}
 
開發者ID:juxeii,項目名稱:dztools,代碼行數:8,代碼來源:OrderRepository.java

示例3: markAsRead

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable markAsRead(int accountId, int peerId) {
    return Completable.fromAction(() -> {
        final Uri uri = MessengerContentProvider.getMessageContentUriFor(accountId);
        final String where = MessageColumns.PEER_ID + " = ? AND " + MessageColumns.OUT + " = ?";
        final String[] args = {String.valueOf(peerId), "0"};
        markAsRead(uri, where, args);
    });
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:10,代碼來源:MessagesStore.java

示例4: evictCredentials

import io.reactivex.Completable; //導入方法依賴的package包/類
private Completable evictCredentials(AuthenticationCredentials credentials) {

        if (PasswordCredentials.class.isAssignableFrom(credentials.getClass())) {
            credentials = new CachedPasswordCredentials((PasswordCredentials) credentials);
        } else if (AuthorizationToken.class.isAssignableFrom(credentials.getClass())) {
            credentials = new CachedAuthorizationToken((AuthorizationToken) credentials);
        } else {
            throw new ServiceException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Invalid credentials type");
        }

        final AuthenticationCredentials cachedCredentails = credentials;

        return Completable.fromAction(() -> cacheManager.evictForGroup(authenticationCacheGroupName, cachedCredentails));
    }
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:15,代碼來源:AuthenticationFacadeImpl.java

示例5: removeLink

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable removeLink(int accountId, String id) {
    return Completable.fromAction(() -> {
        final Uri uri = MessengerContentProvider.getFaveLinksContentUriFor(accountId);
        final String where = FaveLinksColumns.LINK_ID + " LIKE ?";
        final String[] args = {id};
        getContentResolver().delete(uri, where, args);
    });
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:10,代碼來源:FaveStore.java

示例6: removeUser

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable removeUser(int accountId, int userId) {
    return Completable.fromAction(() -> {
        final Uri uri = MessengerContentProvider.getFaveUsersContentUriFor(accountId);
        final String where = FaveUsersColumns._ID + " = ?";
        final String[] args = {String.valueOf(userId)};
        getContentResolver().delete(uri, where, args);
    });
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:10,代碼來源:FaveStore.java

示例7: deleteAsync

import io.reactivex.Completable; //導入方法依賴的package包/類
/**
 * Asynchronously deletes a file handle. Requires security to be set.
 *
 * @see #delete()
 */
public Completable deleteAsync() {
  return Completable.fromAction(new Action() {
    @Override
    public void run() throws Exception {
      delete();
    }
  });
}
 
開發者ID:filestack,項目名稱:filestack-java,代碼行數:14,代碼來源:FileLink.java

示例8: set

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable set(K key, V value) {
    return Completable.fromAction(() -> {
        String valueToWrite = serialize(value);

        try (Jedis jedis = pool.getResource()) {
            jedis.setex(buildKey(key), ttlSeconds, valueToWrite);
        } catch (Exception e) {
            LOG.error("Could not write to Redis", e);

            throw new ServiceException(HttpStatus.SC_INTERNAL_SERVER_ERROR, e);
        }
    });
}
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:15,代碼來源:RedisDaoImpl.java

示例9: changeTitle

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable changeTitle(int accountId, int peedId, String title) {
    return Completable.fromAction(() -> {
        final Uri uri = MessengerContentProvider.getDialogsContentUriFor(accountId);
        ContentValues cv = new ContentValues();
        cv.put(DialogsColumns.TITLE, title);
        getContentResolver().update(uri, cv, DialogsColumns._ID + " = ?", new String[]{String.valueOf(peedId)});
    });
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:10,代碼來源:DialogsStore.java

示例10: remove

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public synchronized Completable remove(String collection, String key) {
  Objects.requireNonNull(collection, NULL_COLLECTION_MESSAGE);
  Objects.requireNonNull(key, NULL_KEY_MESSAGE);

  return Completable.fromAction(() -> {
    Map<String, Map<String, Object>> collectionData = documents.computeIfAbsent(collection, k -> new LinkedHashMap<>());
    collectionData.remove(key);
  });
}
 
開發者ID:cescoffier,項目名稱:fluid,代碼行數:11,代碼來源:InMemoryDocumentView.java

示例11: overwriteAsync

import io.reactivex.Completable; //導入方法依賴的package包/類
/**
 * Asynchronously replace the content of an existing file handle. Requires security to be set.
 * Does not update the filename or MIME type.
 *
 * @see #overwrite(String)
 */
public Completable overwriteAsync(final String pathname) {
  return Completable.fromAction(new Action() {
    @Override
    public void run() throws Exception {
      overwrite(pathname);
    }
  });
}
 
開發者ID:filestack,項目名稱:filestack-java,代碼行數:15,代碼來源:FileLink.java

示例12: demo5

import io.reactivex.Completable; //導入方法依賴的package包/類
private void demo5() {
    Completable completable = Completable.fromAction(() -> {
        log("Let's do something");
    });

    completable.subscribe(() -> {
        log("Finished");
    }, throwable -> {
        log(throwable);
    });


    Single.just("One item")
            .subscribe((item) -> {
                log(item);
            }, (throwable) -> {
                log(throwable);
            });

    Maybe.empty();
    Maybe.just("Item")
            .subscribe(s -> {
                log("On Success: " + s);
            });

    Maybe.just("Item")
            .subscribe(s -> {
                log("On Success: " + s);
            }, throwable -> log("error"));

    Maybe.just("Item")
            .subscribe(
                    s -> log("success: " + s),
                    throwable -> log("error"),
                    () -> log("onComplete")
            );
}
 
開發者ID:PacktPublishing,項目名稱:Reactive-Android-Programming,代碼行數:38,代碼來源:MainActivity.java

示例13: setPassword

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable setPassword(Wallet wallet, String password) {
	return Completable.fromAction(() -> {
           if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
               KS.put(context, wallet.address, password);
           } else {
               try {
                   PasswordManager.setPassword(wallet.address, password, context);
               } catch (Exception e) {
                   throw new ServiceErrorException(
                           ServiceErrorException.KEY_STORE_ERROR);
               }
           }
       });
}
 
開發者ID:TrustWallet,項目名稱:trust-wallet-android,代碼行數:16,代碼來源:TrustPasswordStore.java

示例14: logoutCloudAsync

import io.reactivex.Completable; //導入方法依賴的package包/類
/**
 * Asynchronously logs out from specified cloud.
 *
 * @see #logoutCloud(String)
 */
public Completable logoutCloudAsync(final String providerName) {
  return Completable.fromAction(new Action() {
    @Override
    public void run() throws Exception {
      logoutCloud(providerName);
    }
  });
}
 
開發者ID:filestack,項目名稱:filestack-java,代碼行數:14,代碼來源:Client.java

示例15: invalidatePost

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable invalidatePost(int accountId, int postVkid, int postOwnerId) {
    return Completable.fromAction(() -> {
        Uri uri = getPostsContentUriFor(accountId);
        String where = PostsColumns.POST_ID + " = ? AND " + PostsColumns.OWNER_ID + " = ?";
        String[] args = {String.valueOf(postVkid), String.valueOf(postOwnerId)};

        getContentResolver().delete(uri, where, args);
    });
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:11,代碼來源:WallStore.java


注:本文中的io.reactivex.Completable.fromAction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。