当前位置: 首页>>代码示例>>Java>>正文


Java ThreadPoolManager类代码示例

本文整理汇总了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);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:10,代码来源:AbstractHomematicGateway.java

示例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
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:16,代码来源:BinRpcNetworkService.java

示例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);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:31,代码来源:CloudClient.java


注:本文中的org.eclipse.smarthome.core.common.ThreadPoolManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。