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


Java TridentCollector.reportError方法代碼示例

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


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

示例1: complete

import storm.trident.operation.TridentCollector; //導入方法依賴的package包/類
@Override
public void complete(ReturnResultsState state, TridentCollector collector) {
    // only one of the multireducers will receive the tuples
    if(state.returnInfo!=null) {
        String result = Utils.to_json(state.results);
        Map retMap = (Map) Utils.from_json(state.returnInfo);
        final String host = (String) retMap.get("host");
        final int port = Utils.getInt(retMap.get("port"));
        String id = (String) retMap.get("id");
        DistributedRPCInvocations.Iface client;
        if(local) {
            client = (DistributedRPCInvocations.Iface) ServiceRegistry.getService(host);
        } else {
List server = new ArrayList() {/**
	 * 
	 */
	private static final long serialVersionUID = -2178334393663496091L;

{
                add(host);
                add(port);
            }};

            if(!_clients.containsKey(server)) {
                _clients.put(server, new DRPCInvocationsClient(host, port));
            }
            client = _clients.get(server);
        }

        try {
            client.result(id, result);
        } catch(TException e) {
            collector.reportError(e);
        }
    }
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:37,代碼來源:ReturnResultsReducer.java

示例2: complete

import storm.trident.operation.TridentCollector; //導入方法依賴的package包/類
@Override
public void complete(ReturnResultsState state, TridentCollector collector) {
    // only one of the multireducers will receive the tuples
    if(state.returnInfo!=null) {
        String result = Utils.to_json(state.results);
        Map retMap = (Map) Utils.from_json(state.returnInfo);
        final String host = (String) retMap.get("host");
        final int port = Utils.getInt(retMap.get("port"));
        String id = (String) retMap.get("id");
        DistributedRPCInvocations.Iface client;
        if(local) {
            client = (DistributedRPCInvocations.Iface) ServiceRegistry.getService(host);
        } else {
            List server = new ArrayList() {{
                add(host);
                add(port);
            }};

            if(!_clients.containsKey(server)) {
                _clients.put(server, new DRPCInvocationsClient(host, port));
            }
            client = _clients.get(server);
        }

        try {
            client.result(id, result);
        } catch(TException e) {
            collector.reportError(e);
        }
    }
}
 
開發者ID:songtk,項目名稱:learn_jstorm,代碼行數:32,代碼來源:ReturnResultsReducer.java

示例3: complete

import storm.trident.operation.TridentCollector; //導入方法依賴的package包/類
@Override
public void complete(ReturnResultsState state, TridentCollector collector) {
    // only one of the multireducers will receive the tuples
    if (state.returnInfo != null) {
        String result = JSONValue.toJSONString(state.results);
        Map retMap = (Map) JSONValue.parse(state.returnInfo);
        final String host = (String) retMap.get("host");
        final int port = Utils.getInt(retMap.get("port"));
        String id = (String) retMap.get("id");
        DistributedRPCInvocations.Iface client;
        if (local) {
            client = (DistributedRPCInvocations.Iface) ServiceRegistry.getService(host);
        } else {
            List server = new ArrayList() {
                {
                    add(host);
                    add(port);
                }
            };

            if (!_clients.containsKey(server)) {
                try {
                    _clients.put(server, new DRPCInvocationsClient(conf, host, port));
                } catch (TTransportException ex) {
                    throw new RuntimeException(ex);
                }
            }
            client = _clients.get(server);
        }

        try {
            client.result(id, result);
        } catch (AuthorizationException aze) {
            collector.reportError(aze);
        } catch (TException e) {
            collector.reportError(e);
        }
    }
}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:40,代碼來源:ReturnResultsReducer.java


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