cpu性能优化
parent
619899b028
commit
1493bbfbca
|
@ -73,16 +73,15 @@ public class TasuilingxiaoHandler extends BaseHandler<ActivityProto.Tasuilingxia
|
||||||
// 获取怪物组
|
// 获取怪物组
|
||||||
int[][] contents = sMonsterGroup.getContents();
|
int[][] contents = sMonsterGroup.getContents();
|
||||||
double bossBlood = 0.0; //怪物初始化血量
|
double bossBlood = 0.0; //怪物初始化血量
|
||||||
for (int i = 0; i < contents.length; i++) {
|
for (int[] ints : contents) {
|
||||||
int[] ints = contents[i];
|
for (int anInt : ints) {
|
||||||
for (int j = 0; j < ints.length; j++) {
|
if (anInt == 0) {
|
||||||
if (ints[j] == 0){
|
|
||||||
// 怪物不存在
|
// 怪物不存在
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SMonsterConfig monsterConfig = STableManager.getConfig(SMonsterConfig.class).get(ints[j]);
|
SMonsterConfig monsterConfig = STableManager.getConfig(SMonsterConfig.class).get(anInt);
|
||||||
// 计算总血量
|
// 计算总血量
|
||||||
bossBlood+=monsterConfig.getHp();
|
bossBlood += monsterConfig.getHp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//输
|
//输
|
||||||
|
@ -104,7 +103,7 @@ public class TasuilingxiaoHandler extends BaseHandler<ActivityProto.Tasuilingxia
|
||||||
int goal = 0;
|
int goal = 0;
|
||||||
List<Integer> listState =mission.getActivityMissionMap().entrySet().stream()
|
List<Integer> listState =mission.getActivityMissionMap().entrySet().stream()
|
||||||
.sorted(Map.Entry.comparingByKey()).map(e->e.getValue().getState()).collect(Collectors.toList());
|
.sorted(Map.Entry.comparingByKey()).map(e->e.getValue().getState()).collect(Collectors.toList());
|
||||||
List<Integer>dropList = new ArrayList<Integer>();
|
List<Integer>dropList = new ArrayList<>();
|
||||||
for (int i = 0; i < damageListData.length; i++) {
|
for (int i = 0; i < damageListData.length; i++) {
|
||||||
int[] ints = damageListData[i];
|
int[] ints = damageListData[i];
|
||||||
if(ints[0] > lessBlood){
|
if(ints[0] > lessBlood){
|
||||||
|
|
|
@ -27,7 +27,6 @@ import com.ljsd.jieling.util.SysUtil;
|
||||||
import config.SGameSetting;
|
import config.SGameSetting;
|
||||||
import config.SPlayerLevelConfig;
|
import config.SPlayerLevelConfig;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import org.apache.lucene.util.RamUsageEstimator;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
|
@ -74,7 +73,7 @@ public class UserManager {
|
||||||
//离线清除逻辑
|
//离线清除逻辑
|
||||||
public static void checkOffline(){
|
public static void checkOffline(){
|
||||||
try {
|
try {
|
||||||
LOGGER.info("user map value size is {}", RamUsageEstimator.humanSizeOf(userMap));
|
// LOGGER.info("user map value size is {}", RamUsageEstimator.humanSizeOf(userMap));
|
||||||
Set<User> collect = userMap.entrySet().stream()
|
Set<User> collect = userMap.entrySet().stream()
|
||||||
.filter(integerUserEntry -> !OnlineUserManager.checkUidOnline(integerUserEntry.getKey()))
|
.filter(integerUserEntry -> !OnlineUserManager.checkUidOnline(integerUserEntry.getKey()))
|
||||||
.map(Map.Entry::getValue).collect(Collectors.toSet());
|
.map(Map.Entry::getValue).collect(Collectors.toSet());
|
||||||
|
|
|
@ -880,7 +880,7 @@ public class BuyGoodsNewLogic {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOGGER.info("每秒钟坚持游戏内礼包缓存==================={}",value.getUid());
|
// LOGGER.info("每秒钟坚持游戏内礼包缓存==================={}",value.getUid());
|
||||||
AyyncWorker ayyncWorker = new AyyncWorker(user, false, user1 -> sendGiftGooodsIndication(user1.getId()));
|
AyyncWorker ayyncWorker = new AyyncWorker(user, false, user1 -> sendGiftGooodsIndication(user1.getId()));
|
||||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,14 +146,20 @@ public class MinuteTask extends Thread {
|
||||||
LOGGER.error("Exception::=>{}",e.toString());
|
LOGGER.error("Exception::=>{}",e.toString());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
BuyGoodsNewLogic.minuteCheckReharge();
|
|
||||||
RedisUtil.getInstence().set(RedisKey.ONLINE_NUM+RedisKey.Delimiter_colon+GameApplication.serverId, String.valueOf(OnlineUserManager.sessionMap.entrySet().size()));
|
|
||||||
DeathPathLogic.getInstance().statusCheck();
|
DeathPathLogic.getInstance().statusCheck();
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
LOGGER.error("Exception::=>{}",e.toString());
|
LOGGER.error("Exception::=>{}",e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
BuyGoodsNewLogic.minuteCheckReharge();
|
||||||
|
String key2 = RedisUtil.getInstence().getKey2(RedisKey.ONLINE_NUM, String.valueOf(GameApplication.serverId));
|
||||||
|
RedisUtil.getInstence().set(key2, String.valueOf(OnlineUserManager.sessionMap.entrySet().size()));
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
GuildFightLogic.minuteCheckForCarFight();
|
GuildFightLogic.minuteCheckForCarFight();
|
||||||
reportUserOnline();
|
reportUserOnline();
|
||||||
|
|
Loading…
Reference in New Issue