<commit_before>package org.playorm.monitor.api;

import java.util.Map;

public abstract class MonitorServiceFactory {

	private static final String OUR_IMPL = "org.playorm.monitor.bindings.MonitorServiceFactoryImpl";
	
	public static final String SCAN_RATE_MILLIS = "org.playorm.monitor.scanrate";
	public static final String HOST_UNIQUE_NAME = "org.playorm.monitor.host";	
	
	public synchronized static MonitorService create(Map<String, Object> properties) {
		MonitorServiceFactory newInstance = createInstance(OUR_IMPL);<commit_msg>add a method for fetching a singleton that we use from play so don't have to deal with classloading issues and recreation then<commit_after>package org.playorm.monitor.api;

import java.util.Map;

public abstract class MonitorServiceFactory {

	private static final String OUR_IMPL = "org.playorm.monitor.bindings.MonitorServiceFactoryImpl";
	
	public static final String SCAN_RATE_MILLIS = "org.playorm.monitor.scanrate";
	public static final String HOST_UNIQUE_NAME = "org.playorm.monitor.host";	
	
	private volatile static MonitorService singleton;
	
	public static MonitorService getSingleton(Map<String, Object> properties) {
		//double checked locking is ONLY ok if you use the keyword volatile in java
		if(singleton == null) {
			synchronized(MonitorServiceFactory.class) {
				if(singleton == null)
					singleton = create(properties);
			}
		}
		return singleton;
	}
	
	public synchronized static MonitorService create(Map<String, Object> properties) {
		MonitorServiceFactory newInstance = createInstance(OUR_IMPL);
{'fraction_non_alphanumeric': 0.07495195387572069, 'fraction_numerical': 0.0, 'mean_word_length': 5.535564853556485, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '5324945', 'n_tokens_mistral': 466, 'n_tokens_neox': 423, 'n_words': 127}