コード例 #1
0
  @ProbeListener("glassfish:jersey:server-hidden:requestEnd")
  public void requestEnd() {
    for (AbstractRuleEvent ruleEvent : ruleEvents.get()) {
      ruleEvent.process(currentApplicationStatProvider.get());
    }

    // clean ruleEvents list
    ruleEvents.get().clear();

    UriRuleProbeProvider.requestEnd();
  }
コード例 #2
0
  @ProbeListener("glassfish:jersey:server-hidden:requestStart")
  public void requestStart(@ProbeParam("requestUri") java.net.URI requestUri) {
    UriRuleProbeProvider.requestStart(requestUri.toString());

    // add application to applications (global "statistics")
    String applicationName = getApplicationName(requestUri.getPath());

    ApplicationStatsProvider applicationStatsProvider;

    if (!applicationStatsProviders.containsKey(applicationName)) {
      // register new ApplicationStatsProvider
      applicationStatsProvider = new ApplicationStatsProvider(applicationName);
      applicationStatsProviders.put(applicationName, applicationStatsProvider);

      // strange functionality of PluginPoint.APPLICATIONS; it causes to
      // managed object be registered as "server.server.applications.jersey..."
      // and we ant to have it as "server.applications
      // StatsProviderManager.register("glassfish", PluginPoint.APPLICATIONS,
      //        appName + "/jersey/resources", applicationStatsProvider);

      // workaround for ^^^
      StatsProviderManager.register(
          ContainerMonitoring.JERSEY,
          PluginPoint.SERVER,
          "applications/" + applicationName + "/jersey/resources",
          applicationStatsProvider);

      Logger.getLogger(GlassfishMonitoringServiceProvider.LOGGER_JERSEY_MONITORING)
          .log(
              Level.INFO,
              "ApplicationStatsProvider for application \"" + applicationName + "\" registered");

    } else {
      applicationStatsProvider = applicationStatsProviders.get(applicationName);
    }

    currentApplicationStatProvider.set(applicationStatsProvider);
  }
コード例 #3
0
  @ProbeListener("glassfish:jersey:server-hidden:ruleAccept")
  public void ruleAccept(
      @ProbeParam("ruleName") String ruleName,
      @ProbeParam("path") CharSequence path,
      @ProbeParam("resource") Object resource) {

    UriRuleProbeProvider.ruleAccept(
        ruleName, path.toString(), (resource == null ? "null" : resource.getClass().getName()));

    AbstractRuleEvent ruleEvent;

    if (ruleName.equals(ResourceClassRule.class.getSimpleName())) {
      ruleEvent = new ResourceClassRuleEvent(ruleName, path, resource, ruleEvents.get());
    } else if (ruleName.equals(SubLocatorRule.class.getSimpleName())) {
      ruleEvent = new SubLocatorRuleEvent(ruleName, path, resource, ruleEvents.get());
    } else if (ruleName.equals(ResourceObjectRule.class.getSimpleName())) {
      ruleEvent = new ResourceObjectRuleEvent(ruleName, path, resource, ruleEvents.get());
    } else {
      ruleEvent = new DummyRuleEvent(ruleName, path, resource);
    }

    ruleEvents.get().add(ruleEvent);
  }