分布式数据处理解决方案
来源:互联网 发布:抢网速软件 编辑:程序博客网 时间:2024/05/17 06:26
@Test
public void testIndex() {
int amount = 3;
int index = 2;
if(amount==index){
index=0;
}
int[] ids = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 ,10,11};
for (int id : ids) {
if (amount > 1) {
// 如果为多台服务器,则通过服务器数量对ID取模,如果结果等于当前服务器索引则添加token到任务中
int result = (int) (id % amount);
System.out.println("==="+result+"==="+index+"=====");
if (index == result) {
System.out.println(id);
}
} else {
System.out.println(id);
}
}
}
public void testIndex() {
int amount = 3;
int index = 2;
if(amount==index){
index=0;
}
int[] ids = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 ,10,11};
for (int id : ids) {
if (amount > 1) {
// 如果为多台服务器,则通过服务器数量对ID取模,如果结果等于当前服务器索引则添加token到任务中
int result = (int) (id % amount);
System.out.println("==="+result+"==="+index+"=====");
if (index == result) {
System.out.println(id);
}
} else {
System.out.println(id);
}
}
}
0 0
- 分布式数据处理解决方案
- cobar分布式数据处理
- 分布式数据处理引擎 Presto
- Linux下分布式海量数据处理
- 大数据处理两套解决方案
- 用 Hadoop 进行分布式数据处理(入门)
- 用 Hadoop 进行分布式数据处理(进阶)
- 基于分布式数据库数据处理的研究
- 大数据处理算法(非分布式处理)
- 用Hadoop 进行分布式数据处理(应用程序开发)
- 用 Hadoop 进行分布式数据处理(进阶)
- 海量数据处理---分布式处理之MapReduce
- 大数据处理算法(非分布式处理)
- sqlserver分布式事务解决方案
- 分布式数据库访问解决方案
- 高效分布式操作解决方案
- 分布式平台解决方案
- 分布式云数据中心解决方案
- java的for循环
- iOS C语言2_分支结构
- CentOS 安装软件时,错误Transaction check error ... file...conflicts with file from package zzz的解决
- 获取actionbar上title控件并设置其颜色
- Struts2数据校验详解
- 分布式数据处理解决方案
- js前端动态打开本地文件夹选择本地文件
- pthread_cond_wait的理解
- 欢迎使用CSDN-markdown编辑器
- 黑马程序员--OC中static,self,super等使用
- xcode调试
- Hbase集群扩展
- H.264基本概念
- Java编程中一些常用的小方法