Example usage for java.lang ThreadLocal subclass-usage

List of usage examples for java.lang ThreadLocal subclass-usage

Introduction

In this page you can find the example usage for java.lang ThreadLocal subclass-usage.

Usage

From source file Main.java

class MyThreadLocal extends ThreadLocal {
    private static int n = 10;

    protected Object initialValue() {
        return new Integer(n--);
    }

From source file com.gemstone.gemfire.cache.hdfs.internal.FailureTracker.java

/**
 * Class for tracking failures and backing off if necessary.
 * @author dsmith
 *
 */
public class FailureTracker extends ThreadLocal<MutableInt> {

From source file ThreadIDMain.java

class ThreadID extends ThreadLocal {
    private int nextID;

    public ThreadID() {
        nextID = 10001;
    }

From source file com.bstek.dorado.data.entity.EntityEnhancer.java

class GetterInterceptionInjector extends ThreadLocal<GetterInterceptionInjectorCounter> {

    private GetterInterceptionInjectorCounter getCounter() {
        GetterInterceptionInjectorCounter counter = get();
        if (counter == null) {
            counter = new GetterInterceptionInjectorCounter();

From source file org.eclipse.swtbot.swt.finder.utils.MessageFormat.java

/**
 * Message formatter to optimize logging performance. The cost of logging is mostly in the string concatenation and
 * parameter evaluation of arguments. Log4j logs the object by invoking {@link #toString()} on the object being logged.
 * This class performs lazy evaluation of the message, only when {@link #toString()} is invoked, which happens at the
 * time of logging.
 * <p>

From source file org.paxle.crawler.impl.CrawlerContextLocal.java

@Component(immediate = true)
@Service(ICrawlerContextLocal.class)
@References({
        @Reference(name = CrawlerContextLocal.REFERENCE_SUBPARSERS, referenceInterface = ISubParser.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC, bind = "addSubParser", unbind = "removeSubParser", target = "(MimeTypes=*)"),
        @Reference(name = CrawlerContextLocal.REFERENCE_CRAWLERCONTEXT_AWARE, referenceInterface = ICrawlerContextAware.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC, bind = "addContextAwareCrawler", unbind = "removeContextAwareCrawler"),
        @Reference(name = CrawlerContextLocal.REFERENCE_DOCFACTORY, referenceInterface = IDocumentFactory.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC, bind = "addDocFactory", unbind = "removeDocFactory", target = "(docType=*)") })

From source file org.paxle.parser.impl.ParserContextLocal.java

@Component(immediate = true)
@Service(IParserContextLocal.class)
@References({
        @Reference(name = "docFactory", referenceInterface = IDocumentFactory.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC, bind = "addDocFactory", unbind = "removeDocFactory", target = "(docType=*)"),
        @Reference(name = "parserContextAware", referenceInterface = IParserContextAware.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC, bind = "addContextAwareParser", unbind = "removeContextAwareParser") })
public class ParserContextLocal extends ThreadLocal<IParserContext> implements IParserContextLocal {

From source file org.paxle.se.search.impl.SearchProviderContextLocal.java

@Component(immediate = true)
@Reference(name = "docFactory", referenceInterface = IDocumentFactory.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC, bind = "addDocFactory", unbind = "removeDocFactory", target = "(docType=*)")
public class SearchProviderContextLocal extends ThreadLocal<ISearchProviderContext> {
    private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
    private final Lock r = rwl.readLock();
    private final Lock w = rwl.writeLock();