Files
acc-webapp/src/main/webapp/jsp/sleep2.jsp
jungwon 9cd1052ecc init
2022-03-03 12:08:19 +09:00

55 lines
1.2 KiB
Plaintext

<%@page import="java.util.Calendar"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.concurrent.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<%
String second = request.getParameter("second");
if (second == null )
{
second="1";
}
%>
<%
long start = System.currentTimeMillis();
Thread.sleep(Integer.parseInt(second)*1000);
int cnt=0;
int count=5;
while (true)
{
// double a=Math.random();
// double b=Math.random();
double a=ThreadLocalRandom.current().nextDouble();
double b=ThreadLocalRandom.current().nextDouble();
System.out.println(a);
System.out.println(b);
double c=a*b*a;
if (cnt==count)
break;
cnt++;
}
long end = System.currentTimeMillis();
long gap = (end-start);
%>
<h1 style=" padding:10px;" >Call Success !!!!! </h1> <br>
<h2>elapsed time = <%= gap %> ms </h2> <br>
</html>