public synchronized Answer[] waitFor(int s) throws InterruptedException { if (_disconnected) { return null; } if (_answers != null) { return _answers; } Profiler profiler = new Profiler(); profiler.start(); if (s <= 0) { wait(); } else { int ms = s * 1000; wait(ms); } profiler.stop(); if (s_logger.isTraceEnabled()) { s_logger.trace("Synchronized command - sending completed, time: " + profiler.getDurationInMillis() + ", answer: " + (_answers != null ? _answers[0].toString() : "null")); } return _answers; }
p.start(); int updated = 0; if (updateSeqno) {
profiler.start(); try { wait((timeoutSeconds) * 1000L);
private String executePostMethod(final HttpClient client, final PostMethod method) { int response = 0; String result = null; try { 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: " + profiler.getDurationInMillis() + " ms"); } } else { profiler.stop(); s_logger.error("Invalid response code : " + response + ", from : " + _serviceUrl + ", method : " + method.getParameter("method") + " responding time: " + profiler.getDurationInMillis()); } } catch (final HttpException e) { s_logger.error("HttpException from : " + _serviceUrl + ", method : " + method.getParameter("method")); } catch (final IOException e) { s_logger.error("IOException from : " + _serviceUrl + ", method : " + method.getParameter("method")); } catch (final Throwable e) { s_logger.error("Exception from : " + _serviceUrl + ", method : " + method.getParameter("method") + ", exception :", e); } finally { method.releaseConnection(); } return result; }
profiler.start(); profilerHeartbeatUpdate.start(); txn.transitToAutoManagedConnection(TransactionLegacy.CLOUD_DB); if (s_logger.isTraceEnabled()) { profilerHeartbeatUpdate.stop(); profilerPeerScan.start(); if (s_logger.isTraceEnabled()) { s_logger.trace("Cluster manager peer-scan, id:" + _mshostId);
profiler.start(); profilerQueryActiveList.start(); final List<ManagementServerHostVO> currentList = _mshostDao.getActiveList(new Date(cutTime.getTime() - HeartbeatThreshold.value())); profilerQueryActiveList.stop(); profilerSyncClusterInfo.start(); final List<ManagementServerHostVO> removedNodeList = new ArrayList<ManagementServerHostVO>(); final List<ManagementServerHostVO> invalidatedNodeList = new ArrayList<ManagementServerHostVO>(); profilerInvalidatedNodeList.start(); profilerRemovedList.start();
@Test public void testProfilerInMillis() { //Given final long sleepTimeMillis = SLEEP_TIME_NANO / 1000000L; //When pf.start(); pf.stop(); //Then Assert.assertTrue(pf.getDurationInMillis() == sleepTimeMillis); }
@Test public void testProfilerInNano() { //Given final long sleepTimeNano = SLEEP_TIME_NANO; //When pf.start(); pf.stop(); //Then Assert.assertTrue(pf.getDuration() == sleepTimeNano); }
profiler.start();
@Test public void testProfilerNoStop() { //Given final long expectedAnswer = -1; //When pf.start(); //Then Assert.assertTrue(pf.getDurationInMillis() == expectedAnswer); Assert.assertFalse(pf.isStopped()); } }
profiler.start(); try { wait((timeoutSeconds) * 1000L);
private String executePostMethod(final HttpClient client, final PostMethod method) { int response = 0; String result = null; try { 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: " + profiler.getDurationInMillis() + " ms"); } } else { profiler.stop(); s_logger.error("Invalid response code : " + response + ", from : " + _serviceUrl + ", method : " + method.getParameter("method") + " responding time: " + profiler.getDurationInMillis()); } } catch (final HttpException e) { s_logger.error("HttpException from : " + _serviceUrl + ", method : " + method.getParameter("method")); } catch (final IOException e) { s_logger.error("IOException from : " + _serviceUrl + ", method : " + method.getParameter("method")); } finally { method.releaseConnection(); } return result; } }
profiler.start(); profilerQueryActiveList.start(); final List<ManagementServerHostVO> currentList = _mshostDao.getActiveList(new Date(cutTime.getTime() - HeartbeatThreshold.value())); profilerQueryActiveList.stop(); profilerSyncClusterInfo.start(); final List<ManagementServerHostVO> removedNodeList = new ArrayList<>(); final List<ManagementServerHostVO> invalidatedNodeList = new ArrayList<>(); profilerInvalidatedNodeList.start(); profilerRemovedList.start();
profiler.start();