1
- package codeine .servlet ;
1
+ package codeine .servlet . manage_statistics ;
2
2
3
3
import java .util .Collections ;
4
4
import java .util .Comparator ;
@@ -23,13 +23,13 @@ public class ManageStatisticsCollector {
23
23
public synchronized ManageStatisticsInfo getCollected () {
24
24
List <StringsCommandPair > lastCommands = Lists .newArrayList (lastCommandsInfo .asMap ().values ());
25
25
List <StringWithCount > users = Lists .newArrayList (usersInfo .asMap ().values ());
26
- Comparator < StringWithCount > c = new Comparator <ManageStatisticsCollector .StringWithCount >() {
26
+ Collections . sort ( users , new Comparator <ManageStatisticsCollector .StringWithCount >() {
27
27
@ Override
28
28
public int compare (StringWithCount o1 , StringWithCount o2 ) {
29
29
return o1 .hitCount == o2 .hitCount ? o1 .value .compareTo (o2 .value ) : Integer .compare (o2 .hitCount , o1 .hitCount );
30
30
}
31
- };
32
- Collections .sort (users , c );
31
+ }) ;
32
+ Collections .sort (lastCommands , new StringsCommandPair . CommandComparator () );
33
33
return new ManageStatisticsInfo (users , lastCommands , activeUsersInfo .asMap ().keySet ());
34
34
}
35
35
public synchronized void userAccess (IUserWithPermissions user , final String pathInfo ) {
@@ -40,8 +40,8 @@ public synchronized void userAccess(IUserWithPermissions user, final String path
40
40
throw ExceptionUtils .asUnchecked (e );
41
41
}
42
42
}
43
- public synchronized void commandExecuted (String project , String command_name , String command_id ) {
44
- lastCommandsInfo .put (project + "_" + command_name + "_" + command_id , new StringsCommandPair (project , command_name , command_id ));
43
+ public synchronized void commandExecuted (String project , String command_name , String command_id , long startTime ) {
44
+ lastCommandsInfo .put (project + "_" + command_name + "_" + command_id , new StringsCommandPair (project , command_name , command_id , startTime ));
45
45
}
46
46
private Callable <StringWithCount > getCallable (final String pathInfo ) {
47
47
Callable <StringWithCount > callable = new Callable <ManageStatisticsCollector .StringWithCount >() {
@@ -60,14 +60,5 @@ public StringWithCount(String pathInfo) {
60
60
private String value ;
61
61
private int hitCount ;
62
62
}
63
- @ SuppressWarnings ("unused" )
64
- public static class StringsCommandPair {
65
- public StringsCommandPair (String project , String command_name , String command_id ) {
66
- this .project = project ;
67
- this .command_name = command_name ;
68
- this .command_id = command_id ;
69
- }
70
- private String project , command_name , command_id ;
71
- }
72
63
73
64
}
0 commit comments