本文整理汇总了Java中org.eclipse.smarthome.core.common.ThreadPoolManager类的典型用法代码示例。如果您正苦于以下问题:Java ThreadPoolManager类的具体用法?Java ThreadPoolManager怎么用?Java ThreadPoolManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ThreadPoolManager类属于org.eclipse.smarthome.core.common包,在下文中一共展示了ThreadPoolManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startWatchdogs
import org.eclipse.smarthome.core.common.ThreadPoolManager; //导入依赖的package包/类
@Override
public void startWatchdogs() {
ScheduledExecutorService scheduler = ThreadPoolManager.getScheduledPool(GATEWAY_POOL_NAME);
logger.debug("Starting connection tracker for gateway with id '{}'", id);
connectionTrackerThread = new ConnectionTrackerThread();
connectionTrackerFuture = scheduler.scheduleWithFixedDelay(connectionTrackerThread, 30,
CONNECTION_TRACKER_INTERVAL_SECONDS, TimeUnit.SECONDS);
}
示例2: run
import org.eclipse.smarthome.core.common.ThreadPoolManager; //导入依赖的package包/类
/**
* Listening for events and starts the callbackHandler if a event received.
*/
@Override
public void run() {
while (accept) {
try {
Socket cs = serverSocket.accept();
BinRpcResponseHandler rpcHandler = new BinRpcResponseHandler(cs, rpcResponseHandler, config);
ThreadPoolManager.getPool(RPC_POOL_NAME).execute(rpcHandler);
} catch (IOException ex) {
// ignore
}
}
}
示例3: onComplete
import org.eclipse.smarthome.core.common.ThreadPoolManager; //导入依赖的package包/类
@Override
public void onComplete(Result result) {
// Remove this request from list of running requests
runningRequests.remove(mRequestId);
if (result.isFailed() && result.getResponse().getStatus() != HttpStatus.OK_200) {
logger.warn("Jetty request {} failed: {}", mRequestId, result.getFailure().getMessage());
logger.warn("{}", result.getRequestFailure().getMessage());
logger.warn("{}", result.getResponseFailure().getMessage());
}
/**
* What is this? In some cases where latency is very low the myopenhab service
* can receive responseFinished before the headers or content are received and I
* cannot find another workaround to prevent it.
*/
ThreadPoolManager.getScheduledPool(THREADPOOL_OPENHABCLOUD).schedule(new Runnable() {
@Override
public void run() {
JSONObject responseJson = new JSONObject();
try {
responseJson.put("id", mRequestId);
socket.emit("responseFinished", responseJson);
logger.debug("Finished responding to request {}", mRequestId);
} catch (JSONException e) {
logger.error("{}", e.getMessage());
}
}
}, 1, TimeUnit.MILLISECONDS);
}