本文整理汇总了Java中org.apache.tajo.rpc.RpcChannelFactory类的典型用法代码示例。如果您正苦于以下问题:Java RpcChannelFactory类的具体用法?Java RpcChannelFactory怎么用?Java RpcChannelFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RpcChannelFactory类属于org.apache.tajo.rpc包,在下文中一共展示了RpcChannelFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.apache.tajo.rpc.RpcChannelFactory; //导入依赖的package包/类
@Override
public void stop() {
if (webServer != null) {
try {
webServer.stop();
} catch (Exception e) {
LOG.error(e);
}
}
IOUtils.cleanup(LOG, catalogServer);
if(systemMetrics != null) {
systemMetrics.stop();
}
RpcChannelFactory.shutdown();
super.stop();
LOG.info("Tajo Master main thread exiting");
}
示例2: init
import org.apache.tajo.rpc.RpcChannelFactory; //导入依赖的package包/类
@Override
public void init(Configuration conf) {
try {
manageOsCache = conf.getBoolean(SHUFFLE_MANAGE_OS_CACHE,
DEFAULT_SHUFFLE_MANAGE_OS_CACHE);
readaheadLength = conf.getInt(SHUFFLE_READAHEAD_BYTES,
DEFAULT_SHUFFLE_READAHEAD_BYTES);
int workerNum = conf.getInt("tajo.shuffle.rpc.server.io-thread-num",
Runtime.getRuntime().availableProcessors() * 2);
selector = RpcChannelFactory.createServerChannelFactory("PullServerAuxService", workerNum);
localFS = new LocalFileSystem();
super.init(new Configuration(conf));
this.getConfig().setInt(TajoConf.ConfVars.PULLSERVER_PORT.varname
, TajoConf.ConfVars.PULLSERVER_PORT.defaultIntVal);
} catch (Throwable t) {
LOG.error(t);
}
}
示例3: stop
import org.apache.tajo.rpc.RpcChannelFactory; //导入依赖的package包/类
@Override
public void stop() {
if (webServer != null) {
try {
webServer.stop();
} catch (Exception e) {
LOG.error(e);
}
}
catalogServer.stop();
if(systemMetrics != null) {
systemMetrics.stop();
}
RpcChannelFactory.shutdown();
super.stop();
LOG.info("Tajo Master main thread exiting");
}
示例4: getFetchRunners
import org.apache.tajo.rpc.RpcChannelFactory; //导入依赖的package包/类
private List<Fetcher> getFetchRunners(TaskAttemptContext ctx,
List<Fetch> fetches) throws IOException {
if (fetches.size() > 0) {
releaseChannelFactory();
int workerNum = ctx.getConf().getIntVar(TajoConf.ConfVars.SHUFFLE_FETCHER_PARALLEL_EXECUTION_MAX_NUM);
channelFactory = RpcChannelFactory.createClientChannelFactory("Fetcher", workerNum);
Path inputDir = lDirAllocator.
getLocalPathToRead(
getTaskAttemptDir(ctx.getTaskId()).toString(), systemConf);
File storeDir;
int i = 0;
File storeFile;
List<Fetcher> runnerList = Lists.newArrayList();
for (Fetch f : fetches) {
storeDir = new File(inputDir.toString(), f.getName());
if (!storeDir.exists()) {
storeDir.mkdirs();
}
storeFile = new File(storeDir, "in_" + i);
Fetcher fetcher = new Fetcher(URI.create(f.getUrls()), storeFile, channelFactory);
runnerList.add(fetcher);
i++;
}
ctx.addFetchPhase(runnerList.size(), new File(inputDir.toString()));
return runnerList;
} else {
return Lists.newArrayList();
}
}
示例5: testGet
import org.apache.tajo.rpc.RpcChannelFactory; //导入依赖的package包/类
@Test
public void testGet() throws IOException {
Random rnd = new Random();
FileWriter writer = new FileWriter(INPUT_DIR + "data");
String data;
for (int i = 0; i < 100; i++) {
data = ""+rnd.nextInt();
writer.write(data);
}
writer.flush();
writer.close();
DataRetriever ret = new DirectoryRetriever(INPUT_DIR);
HttpDataServer server = new HttpDataServer(
NetUtils.createSocketAddr("127.0.0.1:0"), ret);
server.start();
InetSocketAddress addr = server.getBindAddress();
URI uri = URI.create("http://127.0.0.1:"+addr.getPort() + "/data");
ClientSocketChannelFactory channelFactory = RpcChannelFactory.createClientChannelFactory("Fetcher", 1);
Fetcher fetcher = new Fetcher(uri, new File(OUTPUT_DIR + "data"), channelFactory);
fetcher.get();
server.stop();
FileSystem fs = FileSystem.getLocal(new TajoConf());
FileStatus inStatus = fs.getFileStatus(new Path(INPUT_DIR, "data"));
FileStatus outStatus = fs.getFileStatus(new Path(OUTPUT_DIR, "data"));
assertEquals(inStatus.getLen(), outStatus.getLen());
}