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

import java.util.concurrent.ExecutorService;

import org.springframework.beans.factory.InitializingBean;

import com.opengamma.engine.ComputationTargetResolver;
import com.opengamma.engine.function.CompiledFunctionService;
import com.opengamma.engine.function.FunctionExecutionContext;
import com.opengamma.engine.function.blacklist.FunctionBlacklistMaintainer;
import com.opengamma.engine.function.blacklist.FunctionBlacklistQuery;
import com.opengamma.engine.view.cache.ViewComputationCacheSource;
import com.opengamma.engine.view.calcnode.stats.DiscardingInvocationStatisticsGatherer;
import com.opengamma.engine.view.calcnode.stats.FunctionInvocationStatisticsGatherer;
import com.opengamma.util.ArgumentChecker;
import com.opengamma.util.log.ThreadLocalLogEventListener;

/**
 * Creates more-or-less identical nodes.
 */
public class SimpleCalculationNodeFactory implements InitializingBean {

  private ViewComputationCacheSource _viewComputationCache;
  private CompiledFunctionService _functionCompilationService;
  private FunctionExecutionContext _functionExecutionContext;
  private ComputationTargetResolver _computationTargetResolver;
  private ViewProcessorQuerySender _viewProcessorQuery;
  private ExecutorService _executorService;
  private FunctionInvocationStatisticsGatherer _statisticsGatherer = new DiscardingInvocationStatisticsGatherer();
  private String _nodeIdentifier;
  private boolean _useWriteBehindSharedCache;
  private boolean _useWriteBehindPrivateCache;
  private boolean _useAsynchronousTargetResolve;
  private FunctionBlacklistQuery _blacklistQuery;
  private FunctionBlacklistMaintainer _blacklistUpdate;
  private MaximumJobItemExecutionWatchdog _maxJobItemExecution;
  private final ThreadLocalLogEventListener _threadLocalLogListener = new ThreadLocalLogEventListener();

  private int _uid;

  public ViewComputationCacheSource getViewComputationCache() {
    return _viewComputationCache;
  }

  public void setViewComputationCache(ViewComputationCacheSource viewComputationCache) {
    ArgumentChecker.notNull(viewComputationCache, "viewComputationCache");
    _viewComputationCache = viewComputationCache;
  }

  public CompiledFunctionService getFunctionCompilationService() {
    return _functionCompilationService;
  }

  public void setFunctionCompilationService(CompiledFunctionService functionCompilationService) {
    ArgumentChecker.notNull(functionCompilationService, "functionCompilationService");
    _functionCompilationService = functionCompilationService;
  }

  public FunctionExecutionContext getFunctionExecutionContext() {
    return _functionExecutionContext;
  }

  public void setFunctionExecutionContext(FunctionExecutionContext functionExecutionContext) {
    ArgumentChecker.notNull(functionExecutionContext, "functionExecutionContext");
    _functionExecutionContext = functionExecutionContext;
  }

  public ComputationTargetResolver getComputationTargetResolver() {<commit_msg>[PLAT-2779] Actually hook up logging<commit_after>/**
 * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 * 
 * Please see distribution for license.
 */
package com.opengamma.engine.view.calcnode;

import java.util.concurrent.ExecutorService;

import org.springframework.beans.factory.InitializingBean;

import com.opengamma.engine.ComputationTargetResolver;
import com.opengamma.engine.function.CompiledFunctionService;
import com.opengamma.engine.function.FunctionExecutionContext;
import com.opengamma.engine.function.blacklist.FunctionBlacklistMaintainer;
import com.opengamma.engine.function.blacklist.FunctionBlacklistQuery;
import com.opengamma.engine.view.cache.ViewComputationCacheSource;
import com.opengamma.engine.view.calcnode.stats.DiscardingInvocationStatisticsGatherer;
import com.opengamma.engine.view.calcnode.stats.FunctionInvocationStatisticsGatherer;
import com.opengamma.util.ArgumentChecker;
import com.opengamma.util.log.LogBridge;
import com.opengamma.util.log.ThreadLocalLogEventListener;

/**
 * Creates more-or-less identical nodes.
 */
public class SimpleCalculationNodeFactory implements InitializingBean {

  private ViewComputationCacheSource _viewComputationCache;
  private CompiledFunctionService _functionCompilationService;
  private FunctionExecutionContext _functionExecutionContext;
  private ComputationTargetResolver _computationTargetResolver;
  private ViewProcessorQuerySender _viewProcessorQuery;
  private ExecutorService _executorService;
  private FunctionInvocationStatisticsGatherer _statisticsGatherer = new DiscardingInvocationStatisticsGatherer();
  private String _nodeIdentifier;
  private boolean _useWriteBehindSharedCache;
  private boolean _useWriteBehindPrivateCache;
  private boolean _useAsynchronousTargetResolve;
  private FunctionBlacklistQuery _blacklistQuery;
  private FunctionBlacklistMaintainer _blacklistUpdate;
  private MaximumJobItemExecutionWatchdog _maxJobItemExecution;
  private final ThreadLocalLogEventListener _threadLocalLogListener;
  
  public SimpleCalculationNodeFactory() {
    _threadLocalLogListener = new ThreadLocalLogEventListener();
    LogBridge.getInstance().addListener(_threadLocalLogListener);
  }

  private int _uid;

  public ViewComputationCacheSource getViewComputationCache() {
    return _viewComputationCache;
  }

  public void setViewComputationCache(ViewComputationCacheSource viewComputationCache) {
    ArgumentChecker.notNull(viewComputationCache, "viewComputationCache");
    _viewComputationCache = viewComputationCache;
  }

  public CompiledFunctionService getFunctionCompilationService() {
    return _functionCompilationService;
  }

  public void setFunctionCompilationService(CompiledFunctionService functionCompilationService) {
    ArgumentChecker.notNull(functionCompilationService, "functionCompilationService");
    _functionCompilationService = functionCompilationService;
  }

  public FunctionExecutionContext getFunctionExecutionContext() {
    return _functionExecutionContext;
  }

  public void setFunctionExecutionContext(FunctionExecutionContext functionExecutionContext) {
    ArgumentChecker.notNull(functionExecutionContext, "functionExecutionContext");
    _functionExecutionContext = functionExecutionContext;
  }

  public ComputationTargetResolver getComputationTargetResolver() {
{'fraction_non_alphanumeric': 0.05654578979717271, 'fraction_numerical': 0.0018438844499078057, 'mean_word_length': 7.66711051930759, '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': '539681', 'n_tokens_mistral': 1613, 'n_tokens_neox': 1616, 'n_words': 308}