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.quartz.impl.jdbcjobstore.DBSemaphore.java

/**
 * Grants a lock on the identified resource to the calling thread (blocking
 * until it is available)./*from   ww w. ja v  a 2s .  c o m*/
 * 
 * @return true if the lock was obtained.
 */
public boolean obtainLock(Connection conn, String lockName) throws LockException {

    lockName = lockName.intern();

    Log log = getLog();

    if (log.isDebugEnabled()) {
        log.debug("Lock '" + lockName + "' is desired by: " + Thread.currentThread().getName());
    }
    if (!isLockOwner(conn, lockName)) {

        executeSQL(conn, lockName, expandedSQL);

        if (log.isDebugEnabled()) {
            log.debug("Lock '" + lockName + "' given to: " + Thread.currentThread().getName());
        }
        getThreadLocks().add(lockName);
        //getThreadLocksObtainer().put(lockName, new
        // Exception("Obtainer..."));
    } else if (log.isDebugEnabled()) {
        log.debug("Lock '" + lockName + "' Is already owned by: " + Thread.currentThread().getName());
    }

    return true;
}

From source file:org.apache.axis.constants.Enum.java

protected Enum(Type type, int value, String name) {
    this.type = type;
    this.value = value;
    this.name = name.intern();
}

From source file:org.corpus_tools.salt.graph.impl.LabelImpl.java

/** {@inheritDoc Label#setNamespace(String)} */
@Override//  w  ww  .  j  a v a 2 s.  com
public void setNamespace(String namespace) {
    if (namespace != null) {
        this.namespace = namespace.intern();
    } else {
        this.namespace = null;
    }
}

From source file:com.almende.eve.transport.LocalTransportBuilder.java

@Override
public Transport build() {
    final Handler<Receiver> newHandle = Transport.TYPEUTIL.inject(getHandle());
    final LocalTransportConfig config = LocalTransportConfig.decorate(getParams());
    final String id = config.getId();
    if (id == null) {
        LOG.warning("Parameter 'id' is required!");
        return null;
    }//from   w  w w .  j a  v  a 2  s.  co  m
    final String addr = "local:" + config.getId();
    final URI address = URIUtil.create(addr.intern());
    LocalService result = getLocal(address);
    if (result == null) {
        result = new LocalService(address, newHandle, getParams());
        INSTANCES.put(address, result);
    } else {
        result.getHandle().update(newHandle);
    }
    return result;
}

From source file:com.qwarz.graph.model.GraphNode.java

@JsonIgnore
@XmlTransient// w w w  .j  a  v a 2s. c  om
public boolean addProperty(String name, String value) {
    if (name == null || name.isEmpty() || value == null || value.isEmpty())
        return false;
    name = name.intern();
    if (properties == null)
        properties = new LinkedHashMap<String, String>();
    else if (properties.containsKey(name))
        return false;
    properties.put(name, value);
    return true;
}

From source file:com.opensearchserver.client.common.CommonResult.java

@XmlTransient
@JsonIgnore/* w  w w .ja v a2s  .com*/
/**
 * Add a detail to the current list
 * @param key the key information
 * @param value the value information
 * @return
 */
public CommonResult addDetail(String key, Object value) {
    if (value == null)
        return this;
    if (details == null)
        details = new LinkedHashMap<String, String>();
    details.put(key.intern(), value.toString());
    return this;
}

From source file:org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizationManager.java

public DeploymentSynchronizer deleteSynchronizer(int tenantId) {
    String filePath = MultitenantUtils.getAxis2RepositoryPath(tenantId);
    synchronized (filePath.intern()) {
        return synchronizers.remove(filePath);
    }//from   www.j a  v  a2 s  .c o  m
}

From source file:org.apache.hadoop.chukwa.rest.resource.ViewResource.java

@DELETE
@Path("delete/{owner}/vid/{vid}")
public ReturnCodeBean deleteView(@Context HttpServletRequest request, @PathParam("owner") String owner,
        @PathParam("vid") String vid) {
    try {/*from w ww .  j  av  a  2s  .c o  m*/
        if (owner.intern() == request.getRemoteUser().intern()) {
            log.info("owner: " + owner + " vid: " + vid);
            ViewStore vs = new ViewStore(owner, vid);
            vs.delete();
        } else {
            throw new WebApplicationException(
                    Response.status(Response.Status.FORBIDDEN).entity("View delete failed.").build());
        }
    } catch (Exception e) {
        log.error(ExceptionUtil.getStackTrace(e));
        throw new WebApplicationException(
                Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("View delete failed.").build());
    }
    return new ReturnCodeBean(ReturnCodeBean.SUCCESS, "Deleted");
}

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

ArgPlaceholderData(final String fullName, final String objectName, final PlaceholderItem<T> item,
        final Object[] args, final boolean containsSubPlaceholders) {
    this.fullName = fullName.intern();
    this.objectName = objectName.intern();
    this.item = item;
    this.args = args;
    this.containsSubPlaceholders = containsSubPlaceholders;
}

From source file:com.opengamma.engine.view.calc.DependencyNodeJobExecutionResult.java

/**
 * Constructs an instance.//from   w  w  w  .j a  va 2s .  c  o m
 * 
 * @param computeNodeId  the identifier of the compute node on which the dependency node was executed, not null
 * @param jobResultItem  the calculation job result item, not null
 */
public DependencyNodeJobExecutionResult(String computeNodeId, CalculationJobResultItem jobResultItem) {
    ArgumentChecker.notNull(computeNodeId, "computeNodeId");
    ArgumentChecker.notNull(jobResultItem, "jobResultItem");
    _computeNodeId = computeNodeId.intern();
    _jobResultItem = jobResultItem;
}