内存战力强制修改
parent
63a587862c
commit
5fd1e90b8a
|
@ -24,42 +24,76 @@ public class InnerMessageUtil {
|
|||
*/
|
||||
public static void broadcastWithRandom(AyyncWorker ayyncWorker, List<Integer> sendId, int timeBound) throws InterruptedException {
|
||||
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
int lastUid=0;
|
||||
for (Integer id : sendId) {
|
||||
User userInMem = UserManager.getUserInMem(id);
|
||||
if(userInMem == null){
|
||||
continue;
|
||||
}
|
||||
ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||
if(lastUid!=0){
|
||||
HandlerLogicThread handlerThread = instance.handlerThreads[lastUid % instance.HANDLER_THREAD_NUM];
|
||||
int retryTimes = 30;
|
||||
while ( !handlerThread.ayyncWorkerConcurrentLinkedQueue.isEmpty()){
|
||||
Thread.sleep(50);
|
||||
retryTimes--;
|
||||
if(retryTimes<0){
|
||||
System.out.println("fail fail ---------------------->>>>>fail..");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Thread.sleep(50);
|
||||
}
|
||||
HandlerLogicThread handlerThread = instance.handlerThreads[id % instance.HANDLER_THREAD_NUM];
|
||||
ayyncWorker.setTask(true);
|
||||
ayyncWorker.setUser(userInMem);
|
||||
handlerThread.addAyyncWorker(ayyncWorker);
|
||||
lastUid =id;
|
||||
|
||||
ThreadManager.getScheduledExecutor().schedule(() -> {
|
||||
try {
|
||||
int lastUid=0;
|
||||
for (Integer id : sendId) {
|
||||
User userInMem = UserManager.getUserInMem(id);
|
||||
if(userInMem == null){
|
||||
continue;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||
if(lastUid!=0){
|
||||
HandlerLogicThread handlerThread = instance.handlerThreads[lastUid % instance.HANDLER_THREAD_NUM];
|
||||
int retryTimes = 30;
|
||||
while ( !handlerThread.ayyncWorkerConcurrentLinkedQueue.isEmpty()){
|
||||
Thread.sleep(50);
|
||||
retryTimes--;
|
||||
if(retryTimes<0){
|
||||
System.out.println("fail fail ---------------------->>>>>fail..");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Thread.sleep(50);
|
||||
}
|
||||
HandlerLogicThread handlerThread = instance.handlerThreads[id % instance.HANDLER_THREAD_NUM];
|
||||
ayyncWorker.setTask(true);
|
||||
ayyncWorker.setUser(userInMem);
|
||||
handlerThread.addAyyncWorker(ayyncWorker);
|
||||
lastUid =id;
|
||||
}
|
||||
}
|
||||
});
|
||||
}catch (Exception e){}
|
||||
}, MathUtils.randomInt(timeBound), TimeUnit.SECONDS);
|
||||
|
||||
//
|
||||
//
|
||||
// ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
// executorService.execute(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// try {
|
||||
// int lastUid=0;
|
||||
// for (Integer id : sendId) {
|
||||
// User userInMem = UserManager.getUserInMem(id);
|
||||
// if(userInMem == null){
|
||||
// continue;
|
||||
// }
|
||||
// ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||
// if(lastUid!=0){
|
||||
// HandlerLogicThread handlerThread = instance.handlerThreads[lastUid % instance.HANDLER_THREAD_NUM];
|
||||
// int retryTimes = 30;
|
||||
// while ( !handlerThread.ayyncWorkerConcurrentLinkedQueue.isEmpty()){
|
||||
// Thread.sleep(50);
|
||||
// retryTimes--;
|
||||
// if(retryTimes<0){
|
||||
// System.out.println("fail fail ---------------------->>>>>fail..");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// Thread.sleep(50);
|
||||
// }
|
||||
// HandlerLogicThread handlerThread = instance.handlerThreads[id % instance.HANDLER_THREAD_NUM];
|
||||
// ayyncWorker.setTask(true);
|
||||
// ayyncWorker.setUser(userInMem);
|
||||
// handlerThread.addAyyncWorker(ayyncWorker);
|
||||
// lastUid =id;
|
||||
// }
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue