我将一个计时器设置为在1小时间隔后执行一些SQL命令,但它会运行4-5次,然后停止运行,尽管以较高间隔设置的其他计时器仍会继续工作。有什么问题吗?我的nohup完全没有错误。
public static void timer025() {
TimerTask t025 = new TimerTask() {
@Override
public void run() {
for (Client c : Load.api.getClients()) {
if (c.isRegularClient() && Load.PlayerExist(c.getUniqueIdentifier())) {
Load.api.sendPrivateMessage(c.getId(),
"[b]123[/b]");
mysql.update("UPDATE game SET coins = coins+0.25 WHERE game.clientid = '"
+ c.getUniqueIdentifier() + "'");
}
}
}
};
TimerTask t026 = new TimerTask() {
@Override
public void run() {
for (Client c : Load.api.getClients()) {
if (c.isRegularClient() && Load.PlayerExist(c.getUniqueIdentifier())) {
if (c.getChannelId() == 1238292) {
Load.api.sendPrivateMessage(c.getId(),
"[b]1234");
mysql.update("UPDATE game SET coins = coins+300 WHERE game.clientid = '"
+ c.getUniqueIdentifier() + "'");
} else {
Load.api.sendPrivateMessage(c.getId(),
"[b]12345[/b]");
mysql.update("UPDATE game SET coins = coins+150 WHERE game.clientid = '"
+ c.getUniqueIdentifier() + "'");
}
}
}
int client = api.getServerInfo().getClientsOnline();
int ret = 200 * client;
mysql.update("UPDATE wallet SET coins = coins-" + ret + " WHERE wallet.uswall = 'mainwall'");
}
};
Timer t = new Timer();
t.schedule(t025, 1000 * 60 * 15, 1000 * 60 * 15);
t.schedule(t026, 1000 * 60 * 60, 1000 * 60 * 60);
}