[Carrot2-cvs] carrot2/components/controllers/carrot2-web-controller/src/com/dawidweiss/carrot/contro
Brought to you by:
dawidweiss,
stachoo
From: <daw...@us...> - 2003-11-27 22:30:34
|
Update of /cvsroot/carrot2/carrot2/components/controllers/carrot2-web-controller/src/com/dawidweiss/carrot/controller/carrot2 In directory sc8-pr-cvs1:/tmp/cvs-serv1807/src/com/dawidweiss/carrot/controller/carrot2 Modified Files: RequestHistory.java Log Message: [new] Recent queries now contain dates. Size of the queries limited to 200 snippets. Index: RequestHistory.java =================================================================== RCS file: /cvsroot/carrot2/carrot2/components/controllers/carrot2-web-controller/src/com/dawidweiss/carrot/controller/carrot2/RequestHistory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RequestHistory.java 26 Nov 2003 22:24:37 -0000 1.1 --- RequestHistory.java 27 Nov 2003 22:30:31 -0000 1.2 *************** *** 12,15 **** --- 12,16 ---- private final Query [] queries; private final ProcessDefinition [] processes; + private final long [] tstamp; private final int max; private int position; *************** *** 26,29 **** --- 27,31 ---- queries = new Query [ length + 1 ]; processes = new ProcessDefinition [ length + 1 ]; + tstamp = new long [ length + 1 ]; max = length + 1; } *************** *** 32,35 **** --- 34,38 ---- { synchronized (this) { + tstamp[position] = System.currentTimeMillis(); queries[position] = query; processes[position] = process; *************** *** 41,44 **** --- 44,68 ---- } + public final int getHistory(int max, Query [] query, ProcessDefinition [] process, long [] tstamps) + { + final int localmax = this.max; + synchronized (this) { + int from = last; + int k = 0; + + while (from != position && max > 0) { + query[k] = this.queries[from]; + process[k] = this.processes[from]; + tstamps[k] = this.tstamp[from]; + + max--; + k++; + from = (from + 1) % localmax; + } + return k; + } + } + + public int getHistory(int max, Query [] query, ProcessDefinition [] process) { *************** *** 50,54 **** while (from != position && max > 0) { query[k] = this.queries[from]; ! process[k] = this.processes[from]; max--; --- 74,78 ---- while (from != position && max > 0) { query[k] = this.queries[from]; ! process[k] = this.processes[from]; max--; |