com.datastax.util.thread.ThreadDispatcher Maven / Gradle / Ivy
package com.datastax.util.thread;
import java.util.ArrayList;
import java.util.List;
/**
* UserItem: Anders Hong
* Date: 6/24/13
* Time: 1:54 PM
*/
public abstract class ThreadDispatcher{
List> groupT=new ArrayList>();
public abstract void runIt(List list);
public ThreadDispatcher(List list, int threadNum){
int total=list.size();
int group=0;
if(total%threadNum==0){
group=total/threadNum;
}else {
group=total/threadNum+1;
}
if(threadNum>list.size()){
threadNum=list.size();
}
for(int i=0;i threadT=new ArrayList();
for(int j=0;j list;
public DispatchThread(List list){
this.list=list;
}
public void run(){
runIt(list);
}
}
}