Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Using Profiler class, from the utils package, instead of System.curre…
…ntTimeMillis()
  • Loading branch information
wilderrodrigues committed Jun 25, 2015
commit 790ad55a463a1b40164bd09c6fdc0621719f5105
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.log4j.Logger;

import com.cloud.utils.Profiler;

public class ClusterServiceServletImpl implements ClusterService {
private static final long serialVersionUID = 4574025200012566153L;
private static final Logger s_logger = Logger.getLogger(ClusterServiceServletImpl.class);
Expand Down Expand Up @@ -87,16 +89,19 @@ private String executePostMethod(final HttpClient client, final PostMethod metho
int response = 0;
String result = null;
try {
final long startTick = System.currentTimeMillis();
final Profiler profiler = new Profiler();
profiler.start();
response = client.executeMethod(method);
if (response == HttpStatus.SC_OK) {
result = method.getResponseBodyAsString();
profiler.stop();
if (s_logger.isDebugEnabled()) {
s_logger.debug("POST " + _serviceUrl + " response :" + result + ", responding time: " + (System.currentTimeMillis() - startTick) + " ms");
s_logger.debug("POST " + _serviceUrl + " response :" + result + ", responding time: " + profiler.getDurationInMillis() + " ms");
}
} else {
profiler.stop();
s_logger.error("Invalid response code : " + response + ", from : " + _serviceUrl + ", method : " + method.getParameter("method") + " responding time: " +
(System.currentTimeMillis() - startTick));
profiler.getDurationInMillis());
}
} catch (final HttpException e) {
s_logger.error("HttpException from : " + _serviceUrl + ", method : " + method.getParameter("method"));
Expand Down