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

org.apache.commons.jre.java.lang.ThreadLocal Maven / Gradle / Ivy

Go to download

Apache Commons Lang, a package of Java utility classes for the classes that are in java.lang's hierarchy, or are considered to be so standard as to justify existence in java.lang. This is a port for GWT, which enables program, to use Apache Commons Lang also in the frontend compiled by the gwt compiler to java-script. The code is tested using the latest revision of the JDK for supported LTS releases: 8, 11, 17 and 21 currently. See https://github.com/apache/commons-lang/blob/master/.github/workflows/maven.yml Please ensure your build environment is up-to-date and kindly report any build issues.

There is a newer version: 3.7-0
Show newest version
package java.lang;

import java.util.WeakHashMap;

public class ThreadLocal {
	
    private WeakHashMap map;

    /**
     * Creates a thread local variable.
     */
    public ThreadLocal() {
    	this.map = new WeakHashMap();
    }

    @SuppressWarnings("unchecked")
	public T get() {
    	return (T) map;
    }

    /**
     * Sets the current thread's copy of this thread-local variable
     * to the specified value.  Most subclasses will have no need to
     * override this method, relying solely on the {@link #initialValue}
     * method to set the values of thread-locals.
     *
     * @param value the value to be stored in the current thread's copy of
     *        this thread-local.
     */
    @SuppressWarnings("unchecked")
	public void set(T value) {
    	this.map = (WeakHashMap) value;
    }

     public void remove() {
    	 // nothing to do.
     }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy