public void afterRequest (@Nonnull final IRequestWebScope aRequestScope) { // Timer per HTTP method m_aTimer.addTime (aRequestScope.getHttpMethod ().getName (), m_aSW.stopAndGetMillis ()); } }
private static <T> T _timedSearch (@Nonnull final IThrowingSupplier <T, IOException> aRunnable, @Nonnull final Query aQuery) throws IOException { final StopWatch aSW = StopWatch.createdStarted (); try { return aRunnable.get (); } finally { final long nMillis = aSW.stopAndGetMillis (); s_aStatsQueryTimer.addTime (aQuery.toString (), nMillis); if (nMillis > CGlobal.MILLISECONDS_PER_SECOND) LOGGER.warn ("Lucene Query " + aQuery + " took too long: " + nMillis + "ms"); } }
@Override protected final void doPost (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse) throws ServletException, IOException { final RequestScopeInitializer aRequestScopeInitializer = beforeRequest (aHttpRequest, aHttpResponse); final StopWatch aSW = new StopWatch (true); try { onPost (aHttpRequest, aHttpResponse, aRequestScopeInitializer.getRequestScope ()); } finally { s_aTimerHdlPost.addTime (aSW.stopAndGetMillis ()); aRequestScopeInitializer.destroyScope (); } }
@Override protected final void doPut (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse) throws ServletException, IOException { final RequestScopeInitializer aRequestScopeInitializer = beforeRequest (aHttpRequest, aHttpResponse); final StopWatch aSW = new StopWatch (true); try { onPut (aHttpRequest, aHttpResponse, aRequestScopeInitializer.getRequestScope ()); } finally { s_aTimerHdlPut.addTime (aSW.stopAndGetMillis ()); aRequestScopeInitializer.destroyScope (); } }
@Override protected final void doHead (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse) throws ServletException, IOException { final RequestScopeInitializer aRequestScopeInitializer = beforeRequest (aHttpRequest, aHttpResponse); final StopWatch aSW = new StopWatch (true); try { onHead (aHttpRequest, aHttpResponse, aRequestScopeInitializer.getRequestScope ()); } finally { s_aTimerHdlHead.addTime (aSW.stopAndGetMillis ()); aRequestScopeInitializer.destroyScope (); } }
@Override protected final void doGet (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse) throws ServletException, IOException { final RequestScopeInitializer aRequestScopeInitializer = beforeRequest (aHttpRequest, aHttpResponse); final StopWatch aSW = new StopWatch (true); try { onGet (aHttpRequest, aHttpResponse, aRequestScopeInitializer.getRequestScope ()); } finally { s_aTimerHdlGet.addTime (aSW.stopAndGetMillis ()); aRequestScopeInitializer.destroyScope (); } }
@Override protected final void doTrace (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse) throws ServletException, IOException { final RequestScopeInitializer aRequestScopeInitializer = beforeRequest (aHttpRequest, aHttpResponse); final StopWatch aSW = new StopWatch (true); try { onTrace (aHttpRequest, aHttpResponse, aRequestScopeInitializer.getRequestScope ()); } finally { s_aTimerHdlTrace.addTime (aSW.stopAndGetMillis ()); aRequestScopeInitializer.destroyScope (); } } }
@Override protected final void doDelete (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse) throws ServletException, IOException { final RequestScopeInitializer aRequestScopeInitializer = beforeRequest (aHttpRequest, aHttpResponse); final StopWatch aSW = new StopWatch (true); try { onDelete (aHttpRequest, aHttpResponse, aRequestScopeInitializer.getRequestScope ()); } finally { s_aTimerHdlDelete.addTime (aSW.stopAndGetMillis ()); aRequestScopeInitializer.destroyScope (); } }
@Override protected final void doOptions (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse) throws ServletException, IOException { final RequestScopeInitializer aRequestScopeInitializer = beforeRequest (aHttpRequest, aHttpResponse); final StopWatch aSW = new StopWatch (true); try { onOptions (aHttpRequest, aHttpResponse, aRequestScopeInitializer.getRequestScope ()); } finally { s_aTimerHdlOptions.addTime (aSW.stopAndGetMillis ()); aRequestScopeInitializer.destroyScope (); } }
public final void contextDestroyed (@Nonnull final ServletContextEvent aSCE) { final ServletContext aSC = aSCE.getServletContext (); final StopWatch aSW = StopWatch.createdStarted (); if (LOGGER.isInfoEnabled ()) LOGGER.info ("Servlet context '" + aSC.getServletContextName () + "' is being destroyed"); // Callback before global scope end beforeContextDestroyed (aSC); // Shutdown global scope and destroy all singletons WebScopeManager.onGlobalEnd (); // Callback after global scope end afterContextDestroyed (aSC); // Handle statistics if (isHandleStatisticsOnEnd ()) handleStatisticsOnEnd (); // Clean commons stuff etc PhotonBasic.shutdown (); if (isOnlyOneInstanceAllowed ()) { // De-init s_aInited.set (false); } if (LOGGER.isInfoEnabled ()) LOGGER.info ("Servlet context '" + aSC.getServletContextName () + "' was destroyed in " + aSW.stopAndGetMillis () + " milli seconds"); }
final long nMillis = aSW.stopAndGetMillis (); if (nMillis > 1000) if (LOGGER.isWarnEnabled ())
aTransaction.commit (); s_aStatsCounterSuccess.increment (); s_aStatsTimerExecutionSuccess.addTime (aSW.stopAndGetMillis ()); return JPAExecutionResult.createSuccess (ret); s_aStatsTimerExecutionError.addTime (aSW.stopAndGetMillis ()); _invokeCustomExceptionCallback (ex); return JPAExecutionResult.createFailure (ex);
s_aStatsTimerExecutionSuccess.addTime (aSW.stopAndGetMillis ()); return JPAExecutionResult.createSuccess (ret); s_aStatsTimerExecutionError.addTime (aSW.stopAndGetMillis ()); _invokeCustomExceptionCallback (ex); return JPAExecutionResult.<T> createFailure (ex);
s_aDomTimerHdl.addTime (aSW.stopAndGetMillis ()); else s_aDomSchemaTimerHdl.addTime (aSW.stopAndGetMillis ());
throw new DAOException ("Failed to write DAO XML data to file"); m_aStatsCounterWriteTimer.addTime (aSW.stopAndGetMillis ()); m_aStatsCounterWriteSuccess.increment (); m_nWriteCount++;
m_aStatsCounterWriteTimer.addTime (aSW.stopAndGetMillis ()); m_aStatsCounterWriteSuccess.increment (); m_nWriteCount++;
final long nExecutionMillis = aSW.stopAndGetMillis (); s_aStatsFunctionTimer.addTime (sPath, nExecutionMillis); final long nLimitMS = APISettings.getLongRunningExecutionLimitTime ();
final long nExecutionMillis = aSW.stopAndGetMillis (); s_aStatsFunctionTimer.addTime (sFunctionName, nExecutionMillis); final long nLimitMS = AjaxSettings.getLongRunningExecutionLimitTime ();
.addTime (aSW.stopAndGetMillis ());
aSC.getServletContextName () + "' was initialized in " + aSW.stopAndGetMillis () + " milli seconds");