All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mentalog.util.LogEventUtils Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package org.mentalog.util;

import org.mentalog.Log;
import org.mentalog.LogEvent;

public class LogEventUtils {

	private static volatile boolean isSynchronized;
	private static ThreadLocal threadLocal;
	private static final LogEvent singleLogEvent = new LogEvent();

	static {
		threadLocal = new ThreadLocal() {
			@Override
			protected LogEvent initialValue() {
				return new LogEvent();
			}
		};

		isSynchronized = Log.isSynchronized();
	}

	public final static LogEvent getLogEvent() {
		if (isSynchronized) {
			return threadLocal.get();
		} else {
			return singleLogEvent;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy