src/main/java/js/container/ThreadScopeFactory.java
@Override
	public Object getInstance(InstanceKey instanceKey) {
		// at this point managed class is guaranteed to be non null

		ThreadLocal<Object> tls = instancesPool.get(instanceKey);
		if (tls == null) {
			synchronized (instancesPool) {
				tls = instancesPool.get(instanceKey);
				if (tls == null) {
					tls = new ThreadLocal<>();
					instancesPool.put(instanceKey, tls);
				}
			}
			return null;
		}

		return tls.get();
	}
@Override
	public Object getInstance(InstanceKey instanceKey) {
		// at this point managed class is guaranteed to be non null

		ThreadLocal<Object> tls = instancesPool.get(instanceKey);
		if (tls == null) {
			synchronized (instancesPool) {
				tls = instancesPool.get(instanceKey);
				if (tls == null) {
					tls = new ThreadLocal<>();
					instancesPool.put(instanceKey, tls);
				}
			}
			return null;
		}

		return tls.get();
	}
Retrieve instance from current thread, bound to given managed class or null if none found. Uses provided managed instance
key to get instance from {@link #instancesPool}. Instance key argument should be not null.

@param instanceKey managed instance key.
@return current thread managed instance or null.