Example usage for java.lang String intern

List of usage examples for java.lang String intern

Introduction

In this page you can find the example usage for java.lang String intern.

Prototype

public native String intern();

Source Link

Document

Returns a canonical representation for the string object.

Usage

From source file:org.diorite.chat.placeholder.BasePlaceholderItem.java

/**
 * Construct new placeholder item, using given type and functiom.
 *
 * @param type type of placeholder, like that "player" in player.name.
 * @param id   id/name of placeholder, like that "name" in player.name.
 * @param func function that should return {@link String} or {@link org.diorite.chat.component.BaseComponent}, when using BaseComponent you may add click events, hovers events and all that stuff.
 *///from w  w  w. j av  a 2 s  . c  o  m
BasePlaceholderItem(final PlaceholderType<T> type, final String id, final Function<T, Object> func) {
    this.type = type;
    this.id = id.intern();
    this.func = func;
}

From source file:org.diorite.chat.placeholder.GlobalPlaceholderItem.java

/**
 * Construct new placeholder item, using given type and functiom.
 *
 * @param type type of placeholder, like that "player" in player.name.
 * @param id   id/name of placeholder, like that "name" in player.name.
 * @param func function that should return {@link String} or {@link org.diorite.chat.component.BaseComponent}, when using BaseComponent you may add click events, hovers events and all that stuff.
 *///from w ww.j  a v  a  2 s.  c  o  m
GlobalPlaceholderItem(final GlobalPlaceholderType<T> type, final String id, final Function<T, Object> func) {
    this.type = type;
    this.id = id.intern();
    this.func = func;
}

From source file:org.bml.util.time.DateFormatFactory.java

/**
 * @param stringFormat a SimpleDateFormat string
 *///w w  w. j a va  2s. c o m
public DateFormatFactory(final String stringFormat, final TimeZone defaultTimeZone) {
    super();
    this.stringFormat = stringFormat.intern();
    this.defaultTimeZone = defaultTimeZone;
}

From source file:org.diorite.chat.placeholder.BasePlaceholderData.java

BasePlaceholderData(final String fullName, final String objectName, final PlaceholderItem<T> item) {
    this.fullName = fullName.intern();
    this.objectName = objectName.intern();
    this.item = item;
}

From source file:org.quartz.impl.jdbcjobstore.SimpleSemaphore.java

/**
 * Determine whether the calling thread owns a lock on the identified
 * resource./*from   w w  w. j  av  a 2 s .com*/
 */
public synchronized boolean isLockOwner(Connection conn, String lockName) {

    lockName = lockName.intern();

    return getThreadLocks().contains(lockName);
}

From source file:com.jaeksoft.searchlib.ClientCatalogItem.java

public ClientCatalogItem(String indexName) {
    this.indexName = indexName == null ? null : indexName.intern();
    this.lastModifiedAndSize = null;
}

From source file:com.recalot.model.data.connections.reddit.RedditDataSource.java

private void addNewItem(String word) {
    word = word.intern();
    if (!items.containsKey(word)) {
        items.put(word, new Item(word));
    }//from   ww  w.  j a  va  2s  .  c  o  m
}

From source file:com.silverwrist.dynamo.servlet.BrowserDatabaseEntry.java

/**
 * Constructs a new <CODE>BrowserDatabaseEntry</CODE>.
 *
 * @param header Header line for this entry.
 *///  ww  w. j a v a 2s .co  m
BrowserDatabaseEntry(String header) {
    m_id = header.intern();
    m_pattern = Pattern.compile(preprocess(header));
    s_name_map.put(m_id, this);

}

From source file:org.quartz.impl.jdbcjobstore.SimpleSemaphore.java

/**
 * Release the lock on the identified resource if it is held by the calling
 * thread.//  www.  j  a  v a 2s . c  o  m
 */
public synchronized void releaseLock(Connection conn, String lockName) {

    lockName = lockName.intern();

    if (isLockOwner(conn, lockName)) {
        if (getLog().isDebugEnabled()) {
            getLog().debug("Lock '" + lockName + "' retuned by: " + Thread.currentThread().getName());
        }
        getThreadLocks().remove(lockName);
        locks.remove(lockName);
        this.notifyAll();
    } else if (getLog().isDebugEnabled()) {
        getLog().debug("Lock '" + lockName + "' attempt to retun by: " + Thread.currentThread().getName()
                + " -- but not owner!", new Exception("stack-trace of wrongful returner"));
    }
}

From source file:org.dataconservancy.dcs.ingest.services.util.ElmSipStager.java

public void removeSIP(String key) {
    synchronized (key.intern()) {
        entityStore.remove(key);
        metadataStore.remove(key);
    }
}