<commit_before>/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.livedata.server;

import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedOperationParameter;
import org.springframework.jmx.export.annotation.ManagedOperationParameters;
import org.springframework.jmx.export.annotation.ManagedResource;

import com.opengamma.livedata.msg.LiveDataSubscriptionResponse;
import com.opengamma.livedata.msg.LiveDataSubscriptionResult;
import com.opengamma.util.ArgumentChecker;

/**
 * JMX management of a LiveData server.
 */
@ManagedResource(
    objectName = "com.opengamma:name=LiveDataServer",
    description = "LiveData server attributes and operations that can be managed via JMX"
    )
public class LiveDataServerMBean {
  
  private static final Logger s_logger = LoggerFactory.getLogger(LiveDataServerMBean.class);
  private final AbstractLiveDataServer _server;
  
  public LiveDataServerMBean(AbstractLiveDataServer server) {
    ArgumentChecker.notNull(server, "Live Data Server");
    _server = server;
  }
  
  @ManagedAttribute(description = "How many different tickers the server subscribes to.")
  public int getNumActiveSubscriptions() {
    try {
      return _server.getNumActiveSubscriptions();
    } catch (RuntimeException e) {
      s_logger.error("getNumActiveSubscriptions() failed", e);
      throw new RuntimeException(e.getMessage());
    }
  }
  
  @ManagedAttribute(description = "Security IDs the server subscribes to."
      + " The form of the IDs is dependent on the source system"<commit_msg>Some more mbean properties for live data servers<commit_after>/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.livedata.server;

import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedOperationParameter;
import org.springframework.jmx.export.annotation.ManagedOperationParameters;
import org.springframework.jmx.export.annotation.ManagedResource;

import com.opengamma.livedata.msg.LiveDataSubscriptionResponse;
import com.opengamma.livedata.msg.LiveDataSubscriptionResult;
import com.opengamma.util.ArgumentChecker;

/**
 * JMX management of a LiveData server.
 */
@ManagedResource(
    description = "LiveData server attributes and operations that can be managed via JMX"
    )
public class LiveDataServerMBean {
  
  private static final Logger s_logger = LoggerFactory.getLogger(LiveDataServerMBean.class);
  private final AbstractLiveDataServer _server;
  
  public LiveDataServerMBean(AbstractLiveDataServer server) {
    ArgumentChecker.notNull(server, "Live Data Server");
    _server = server;
  }
  
  @ManagedAttribute(description = "The unique id domain of the underlying server.")
  public String getUniqueIdDomain() {
    try {
      return _server.getUniqueIdDomain().toString();
    } catch (RuntimeException e) {
      s_logger.error("getUniqueIdDomain() failed", e);
      throw new RuntimeException(e.getMessage());
    }
  }
  
  @ManagedAttribute(description = "The type of the underlying server.")
  public String getServerType() {
    try {
      return _server.getClass().getName();
    } catch (RuntimeException e) {
      s_logger.error("getServerType() failed", e);
      throw new RuntimeException(e.getMessage());
    }
  }
  
  @ManagedAttribute(description = "How many different tickers the server subscribes to.")
  public int getNumActiveSubscriptions() {
    try {
      return _server.getNumActiveSubscriptions();
    } catch (RuntimeException e) {
      s_logger.error("getNumActiveSubscriptions() failed", e);
      throw new RuntimeException(e.getMessage());
    }
  }
  
  @ManagedAttribute(description = "Security IDs the server subscribes to."
      + " The form of the IDs is dependent on the source system"
{'fraction_non_alphanumeric': 0.08998380754105945, 'fraction_numerical': 0.002775850104094379, 'mean_word_length': 4.64490861618799, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5399079', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1176, 'n_words': 306}