some scheduler testing testing

This commit is contained in:
7u83
2017-04-11 07:56:43 +02:00
parent f0888a55d0
commit 4dcc9d8d56
6 changed files with 38 additions and 24 deletions

View File

@ -1136,6 +1136,7 @@ public class Exchange {
Account a = accounts.get(account_id);
if (a == null) {
System.out.printf("Order not places account\n");
return -1;
}
@ -1154,7 +1155,7 @@ public class Exchange {
buy_failed++;
break;
}
System.out.printf("Order ffailed %f %f \n",o.volume,o.limit);
return -1;

View File

@ -268,6 +268,7 @@ public class Scheduler extends Thread {
// HashMap<TimerTaskDef, Long> tasks = new HashMap<>();
private boolean addTimerTask(TimerTaskDef e) {
// System.out.printf("Add TimerTask %d %d\n",e.curevtime,e.newevtime);
// long evtime = time + currentTimeMillis();
SortedSet<TimerTaskDef> s = event_queue.get(e.newevtime);
if (s == null) {
@ -293,9 +294,10 @@ public class Scheduler extends Thread {
// if (evtime == null) {
// return;
// }
System.out.printf("Cancel my %d\n", e.id);
SortedSet<TimerTaskDef> s = event_queue.get(e.curevtime);
if (s == null) {
System.out.printf("My not found\n");
return;
}
@ -389,6 +391,8 @@ public class Scheduler extends Thread {
while (!set_tasks.isEmpty()) {
TimerTaskDef td = set_tasks.poll();
System.out.printf("There is a set task %d %d\n",td.curevtime,td.newevtime);
this.cancelMy(td);
this.addTimerTask(td);