Added try-catches to schedulers to identify errors

This commit is contained in:
Treeku
2014-06-18 08:06:27 +01:00
parent b44ddd3b31
commit 97af15a747
20 changed files with 558 additions and 406 deletions
+12 -8
View File
@@ -873,14 +873,18 @@ public class BazaarService implements INetworkDispatch {
public void startVendorUpdateTask(CreatureObject owner, SWGObject vendor) {
scheduler.scheduleAtFixedRate(() -> {
if(vendor == null || !((Boolean) vendor.getAttachment("initialized")))
return;
float maintenanceRate = 15;
if((Boolean) vendor.getAttachment("onMap"))
maintenanceRate += 6;
vendor.setAttachment("maintenanceAmount", (Integer) vendor.getAttachment("maintenanceAmount") - maintenanceRate);
// TODO add vendor delete after x days
try {
if(vendor == null || !((Boolean) vendor.getAttachment("initialized")))
return;
float maintenanceRate = 15;
if((Boolean) vendor.getAttachment("onMap"))
maintenanceRate += 6;
vendor.setAttachment("maintenanceAmount", (Integer) vendor.getAttachment("maintenanceAmount") - maintenanceRate);
// TODO add vendor delete after x days
} catch (Exception e) {
e.printStackTrace();
}
}, 1, 1, TimeUnit.HOURS);
}