-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsp
More file actions
63 lines (55 loc) · 1.55 KB
/
index.jsp
File metadata and controls
63 lines (55 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<h2>Java/Spring concurrency test on session</h2>
<p>Run with:
<a href="?nosync">no sync</a> |
sync on:
<a href="?instance">instance</a> |
<a href="?autowired">autowired</a> |
<a href="?sessionmutex">sessionmutex</a>
</p>
<script>
(function() {
$.ajaxSetup ({
cache: false
});
var endpoint = "/api/cars?responseDelay=5000",
parallellRequests = 3;
if(window.location.search.length > 0) {
endpoint += "&mode=" + window.location.search.substring(1);
$.ajax({
type: "POST",
url: "/api/session",
dataType: "json"
}).done(function() {
$.when.apply(this, (function() {
var requests = [];
for(var i = 0; i < parallellRequests; i++) {
requests.push(createRequest(i+1));
}
return requests;
})()).done(function() {
$.ajax({
type: "DELETE",
url: "/api/session",
dataType: "json"
});
});
}).fail(function(xhr, errorText, errorThrown) {
debugger;
});
}
function createRequest(id) {
$("body").append("<p>Request " + id + " starting...</p>");
return $.getJSON(endpoint, function(data) {
$("body").append("<p>Request " + id + " complete</p>");
});
}
})();
</script>
</body>
</html>