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

io.tracee.backend.threadlocalstore.ThreadLocalTraceeBackend Maven / Gradle / Ivy

Go to download

This is a simple implementation of a tracee backend. It might be used for system where no supported logging framework is present or for test purpose.

There is a newer version: 1.2.0
Show newest version
package io.tracee.backend.threadlocalstore;

import io.tracee.BackendBase;

import java.util.HashMap;
import java.util.Map;

class ThreadLocalTraceeBackend extends BackendBase {

	private final ThreadLocalMap threadLocalMap;

	public ThreadLocalTraceeBackend() {
		this.threadLocalMap = new ThreadLocalMap();
	}


	@Override
	public boolean containsKey(String key) {
		return threadLocalMap.get().containsKey(key);
	}

	@Override
	public int size() {
		return threadLocalMap.get().size();
	}

	@Override
	public boolean isEmpty() {
		return threadLocalMap.get().isEmpty();
	}

	@Override
	public String get(String key) {
		return threadLocalMap.get().get(key);
	}

	@Override
	public void put(String key, String value) {
		threadLocalMap.get().put(key, value);
	}

	@Override
	public void remove(String key) {
		threadLocalMap.get().remove(key);
	}

	@Override
	public void clear() {
		threadLocalMap.get().clear();
	}

	@Override
	public void putAll(Map entries) {
		threadLocalMap.get().putAll(entries);
	}

	@Override
	public Map copyToMap() {
		return new HashMap(threadLocalMap.get());
	}

	ThreadLocalMap getThreadLocalMap() {
		return threadLocalMap;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy