future

    0熱度

    1回答

    使用貓,我有我的仿函數聲明在包對象中。這工作得很好,除了futureFunctor,因爲它需要一個隱含的ExecutionContext: package object util { implicit val futureFunctor: Functor[Future] = new Functor[Future] { //requires execution context:

    0熱度

    1回答

    我想用pyomo.environ進口*和有這樣的代碼: ## Define sets ## model.i = Set(initialize=i_set) model.p = Set(initialize=j_set) ## Define parameters ## model.precedence = Param (model.i, initialize=precedence, doc

    7熱度

    1回答

    我想用OptionT來結合方法返回Future[Option[T]]在for-comprehension。 import cats.data._ import cats.implicits._ import cats.instances.future._ for { data <- OptionT(repo.getData(id)) ... } 編譯器錯誤,我越來

    0熱度

    1回答

    我必須將一個調度http請求包裝到另一個Future中,因爲它看起來最初的網絡連接可能會阻塞(在Netty中或其後面 - 這是爲了例如,當計算機僅連接到具有靜態IP且沒有DNS的其他計算機時;在未來實際創建之前,系統塊需要十秒或更長時間)。因此,而不是 Http(req.OK(JsonUTF)) 我現在有 Future { blocking( Http(req.OK(Json

    -1熱度

    1回答

    我正在寫一個Action in Play應該在MongoDB中添加一個文檔,如果它不存在的話。我嘗試了兩種方法,但都沒有工作。我卡住周圍如何處理未來響應mongoplugin 行動獲取JSON數據。它減弱它。如果JSON正常,我會檢查用戶是否存在(查看名字)。如果它不,我想添加它,否則返回一個錯誤。我無法將ReactiveMongoPlugin的「查找」和「插入」方法結合在同一個動作中。 方法1

    -1熱度

    1回答

    我有下面的代碼: package controllers.usersPage import play.api.mvc._ import play.api.libs.json._ import model.{User, Users, Patients, CObject} import scala.concurrent.Future import service.{UserService

    2熱度

    1回答

    我有以下代碼: extern crate futures; extern crate futures_cpupool; extern crate tokio_timer; use std::time::Duration; use futures::Future; use futures_cpupool::CpuPool; use tokio_timer::Timer; fn w

    4熱度

    1回答

    考慮下面的代碼 extern crate futures; use std::sync::{atomic, Arc}; use futures::*; struct F(Arc<atomic::AtomicBool>); impl Future for F { type Item =(); type Error =(); fn poll(&mut se

    0熱度

    1回答

    io.grpc.StatusRuntimeException: CANCELLED at io.grpc.Status.asRuntimeException(Status.java:539) at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:439) at io.grpc.

    0熱度

    1回答

    我有一個方法producer.postMessage(消息),這將消息發送到一些隊列。如果由於某種原因,郵件無法在一段時間內發送,我希望此任務被取消。我想到了下面的實現。我的問題是,如果有中斷,我可以確定Future task/executor服務全部關閉,如果不需要做出什麼改變,使得這個工作沒有任何線程沒有被終止。 非常感謝 public void postMessage(final Objec