use of org.smartdata.protocol.protobuffer.ClientProtocolClientSideTranslator in project SSM by Intel-bigdata.
the class SmartClient method initialize.
private void initialize(InetSocketAddress[] addrs) throws IOException {
RPC.setProtocolEngine(conf, ClientProtocolProtoBuffer.class, ProtobufRpcEngine.class);
List<InetSocketAddress> orderedAddrs = new ArrayList<>();
InetSocketAddress recordedActiveAddr = getActiveServerAddress();
if (recordedActiveAddr != null) {
orderedAddrs.add(recordedActiveAddr);
}
for (InetSocketAddress addr : addrs) {
if (!addr.equals(recordedActiveAddr)) {
orderedAddrs.add(addr);
}
}
for (InetSocketAddress addr : orderedAddrs) {
ClientProtocolProtoBuffer proxy = RPC.getProxy(ClientProtocolProtoBuffer.class, VERSION, addr, conf);
SmartClientProtocol server = new ClientProtocolClientSideTranslator(proxy);
serverQue.addLast(server);
serverToRpcAddr.put(server, addr.getHostName() + ":" + addr.getPort());
}
// SMART_IGNORE_DIRS_KEY and SMART_WORK_DIR_KEY should be configured on
// application side if its dfsClient is replaced by SmartDfsClient.
Collection<String> ignoreDirs = conf.getTrimmedStringCollection(SmartConfKeys.SMART_IGNORE_DIRS_KEY);
// The system folder and SSM work folder should be ignored to
// report access count.
ignoreDirs.add(SmartConstants.SYSTEM_FOLDER);
ignoreDirs.add(conf.get(SmartConfKeys.SMART_WORK_DIR_KEY, SmartConfKeys.SMART_WORK_DIR_DEFAULT));
for (String s : ignoreDirs) {
ignoreAccessEventDirs.add(s + (s.endsWith("/") ? "" : "/"));
}
Collection<String> coverDirs = conf.getTrimmedStringCollection(SmartConfKeys.SMART_COVER_DIRS_KEY);
for (String s : coverDirs) {
coverAccessEventDirs.add(s + (s.endsWith("/") ? "" : "/"));
}
}
Aggregations