com.atlassian.util.profiling.UtilTimerStack类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中com.atlassian.util.profiling.UtilTimerStack类的一些代码示例,展示了UtilTimerStack类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UtilTimerStack类的具体详情如下:
包路径:com.atlassian.util.profiling.UtilTimerStack
类名称:UtilTimerStack

UtilTimerStack介绍

[英]A timer stack.

Usage:

String logMessage = "Log message"; 
UtilTimerStack.push(logMessage); 
try { 
//do some code 
} finally { 
UtilTimerStack.pop(logMessage); //this needs to be the same text as above 
}

[中]计时器堆栈。
用法:

String logMessage = "Log message"; 
UtilTimerStack.push(logMessage); 
try { 
//do some code 
} finally { 
UtilTimerStack.pop(logMessage); //this needs to be the same text as above 
}

代码示例

代码示例来源:origin: com.atlassian.xwork/atlassian-xwork-core

public void doExecute(String finalLocation, ActionInvocation invocation) throws Exception
{
  UtilTimerStack.push("XW View: doExecute(" + finalLocation + ")");
  try
  {
    super.doExecute(finalLocation, invocation);
  }
  finally
  {
    UtilTimerStack.pop("XW View: doExecute(" + finalLocation + ")");
  }
}

代码示例来源:origin: com.atlassian.user/atlassian-user-core

public static void pop(Supplier<String> supplier) {
    if (UtilTimerStack.isActive()) {
      UtilTimerStack.pop(supplier.get());
    }
  }
}

代码示例来源:origin: com.atlassian.user/atlassian-user-core

public static void push(Supplier<String> supplier) {
  if (UtilTimerStack.isActive()) {
    UtilTimerStack.push(supplier.get());
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

public String getHtml(final Map displayParams, final Issue issue)
{
  final FieldLayout fieldLayout = ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue);
  final String hiddenFieldId = getNavigableField().getHiddenFieldId();
  if ((fieldLayout == null) || ((hiddenFieldId != null) && fieldLayout.isFieldHidden(hiddenFieldId)))
  {
    return "";
  }
  else
  {
    final String timerName = !UtilTimerStack.isActive() ? "" : "Rendering navigable field '" + getNavigableField().getId() + "' for issue: " + (issue == null ? "null" : issue.getKey());
    try
    {
      UtilTimerStack.push(timerName);
      return getNavigableField().getColumnViewHtml(fieldLayout.getFieldLayoutItem(getNavigableField().getId()), displayParams, issue);
    }
    finally
    {
      UtilTimerStack.pop(timerName);
    }
  }
}

代码示例来源:origin: com.atlassian.bonnie/atlassian-bonnie

@Override
  public void unlock()
  {
    if (log.isDebugEnabled())
      log.debug("Releasing lock: " + name);
    super.unlock();
    UtilTimerStack.pop(getClass().getName() + "." + name);
  }
}

代码示例来源:origin: com.atlassian.bonnie/atlassian-bonnie

@Override
public void lock()
{
  if (log.isDebugEnabled())
    log.debug("Acquiring lock: " + name);
  UtilTimerStack.push(getClass().getName() + "." + name);
  super.lock();
}

代码示例来源:origin: com.atlassian.jira/jira-core

public boolean isProfilingEnabled()
{
  return UtilTimerStack.isActive();
}

代码示例来源:origin: com.atlassian.jira/jira-core

params.put("userNavLayout", new UserNavContextLayoutBean(request));
params.put("systemNavLayout", new SystemNavContextLayoutBean(request));
params.put("utilTimerStack", new UtilTimerStack());
Project selectedProject = userProjectHistoryManager.getCurrentProject(Permissions.BROWSE, authenticationContext.getUser());
params.put("selectedProject", selectedProject);

代码示例来源:origin: com.atlassian.xwork/atlassian-xwork-core

protected void after(ActionInvocation actionInvocation, String string) throws Exception
{
  UtilTimerStack.pop(makeStackKey(actionInvocation.getProxy()));
}

代码示例来源:origin: com.atlassian.xwork/atlassian-xwork-core

protected void before(ActionInvocation actionInvocation) throws Exception
{
  UtilTimerStack.push(makeStackKey(actionInvocation.getProxy()));
  ServletActionContext.getRequest(); // needed to make sure the request is present (I think)
}

代码示例来源:origin: com.atlassian.jira/jira-core

public static void store(final String group, final String query, final long time)
{
  if (UtilTimerStack.isActive())
  {
    getProfiler().storeDataPoint(group, query, time);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

params.put("utilTimerStack", new UtilTimerStack());
params.put("version", buildUtilsInfo.getVersion());
params.put("buildNumber", buildUtilsInfo.getCurrentBuildNumber());

代码示例来源:origin: com.atlassian.xwork/atlassian-xwork-core

@Override
  protected Template getTemplate(ValueStack stack, VelocityEngine velocity, ActionInvocation invocation, String location, String encoding) throws Exception
  {
    UtilTimerStack.push("XW View: getTemplate(" + location + ")");
    try
    {
      return super.getTemplate(stack, velocity, invocation, location, encoding);
    }
    finally
    {
      UtilTimerStack.pop("XW View: getTemplate(" + location + ")");
    }
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

public static void end() throws IOException
{
  final ThreadLocalQueryProfiler profiler = getProfiler();
  if (UtilTimerStack.isActive())
  {
    profiler.printData();
    profiler.clearData();
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

private Map<String, ProjectRoleActorModuleDescriptor> getImplementationsMap()
{
  UtilTimerStack.push("DefaultRoleActorFactory.getImplementations");
  UtilTimerStack.push("DefaultRoleActorFactory.getImplementations-getEnabledModuleDescriptorByClass");
  List<ProjectRoleActorModuleDescriptor> descriptors = pluginAccessor.getEnabledModuleDescriptorsByClass(ProjectRoleActorModuleDescriptor.class);
  UtilTimerStack.pop("DefaultRoleActorFactory.getImplementations-getEnabledModuleDescriptorByClass");
  Map<String, ProjectRoleActorModuleDescriptor> actorsByType = Maps.newHashMapWithExpectedSize(descriptors.size());
  for (final ProjectRoleActorModuleDescriptor projectRoleModuleDescriptor : descriptors)
  {
    actorsByType.put(projectRoleModuleDescriptor.getKey(), projectRoleModuleDescriptor);
  }
  UtilTimerStack.pop("DefaultRoleActorFactory.getImplementations");
  return actorsByType;
}

代码示例来源:origin: com.atlassian.jira/jira-core

public static void start()
{
  if (UtilTimerStack.isActive())
  {
    getProfiler().clearData();
    getProfiler().begin();
  }
}

代码示例来源:origin: com.atlassian.jira.plugins/jira-fisheye-plugin

private void log(Response response) throws ResponseException
{
  if (log.isTraceEnabled())
  {
    String timerKey = "debug request.getResponseBodyAsString()";
    try
    {
      UtilTimerStack.push(timerKey);
      log.trace("Response: " + response.getResponseBodyAsString());
    }
    finally
    {
      UtilTimerStack.pop(timerKey);
    }
  }
}

代码示例来源:origin: com.atlassian.jira.plugins/jira-fisheye-plugin

private void log(Response response) throws ResponseException
{
  if (log.isTraceEnabled())
  {
    String timerKey = "debug request.getResponseBodyAsString()";
    try
    {
      UtilTimerStack.push(timerKey);
      log.trace("Response: " + response.getResponseBodyAsString());
    }
    finally
    {
      UtilTimerStack.pop(timerKey);
    }
  }
}

代码示例来源:origin: com.atlassian.confluence.extra/confluence-flyingpdf-plugin

public boolean exportableContentExists() {
  UtilTimerStack.push("BetterExportSpaceAction.exportableContentExists");
  boolean containsStuff = pdfExporterService.exportableContentExists(getSpace());
  UtilTimerStack.pop("BetterExportSpaceAction.exportableContentExists");
  return containsStuff;
}

代码示例来源:origin: com.atlassian.jira/jira-api

@Override
public String execute() throws Exception
{
  final String logLine = getActionName() + ".execute()";
  UtilTimerStack.push(logLine);
  try
  {
    return super.execute();
  }
  finally
  {
    UtilTimerStack.pop(logLine);
  }
}

相关文章

微信公众号

最新文章

更多