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.bml.util.cache.jcs.IntToIntCache.java

/**
 * Constructor for building a generic int to int cache supported by JCS and 
 * lookup backed by a database. // w  w  w  . j a v a2s  .co  m
 * 
 * @param theCacheRegionName The name of the JCS cache region.
 * @param theCacheProperties The Properties object used to configure the JCS cache.
 * @param theLookupSQL A prepared statement where an integer of position 1 can be set with a key,
 * executed and a value for caching returned if it exists.
 */
public IntToIntCache(final String theCacheRegionName, final Properties theCacheProperties,
        final String theLookupSQL) {
    coreInit(this.getClass());
    this.theLookupSQL = theLookupSQL.intern();
    //Configure JCS cache region
    this.theCacheRegionName = theCacheRegionName;
    this.theCacheProperties = theCacheProperties;
    //TODO: Should check for preconfigured cache region    
    CompositeCacheManager theCompositeCacheManager = CompositeCacheManager.getUnconfiguredInstance();
    theCompositeCacheManager.configure(theCacheProperties);
    try {
        theCache = JCS.getInstance(theCacheRegionName);
    } catch (CacheException myCacheException) {
        if (theLog.isErrorEnabled()) {
            theLog.error("Unable to build/retrieve JSC cache region " + theCacheRegionName, myCacheException);
        }
        theCache = null;
    }
}

From source file:com.thoughtworks.go.server.cache.GoCache.java

public void remove(String key, String subKey) {
    synchronized (key.intern()) {
        KeyList subKeys = subKeyFamily(key);
        if (subKeys == null) {
            return;
        }//from ww  w  . j a  v  a2s  .co  m
        subKeys.remove(subKey);
        remove(compositeKey(key, subKey));
    }
}

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

@POST
@Path("permission")
public ReturnCodeBean changeViewPermission(@Context HttpServletRequest request,
        @FormParam("owner") String owner, @FormParam("view_vid") String vid,
        @FormParam("permission") String permission) {
    try {/*w  ww.ja  v a2 s.c o  m*/
        if (owner.intern() == request.getRemoteUser().intern()) {
            ViewStore vs = new ViewStore(owner, vid);
            ViewBean view = vs.get();
            view.setPermissionType(permission);
            vs.set(view);
        } else {
            throw new Exception("Permission denied.");
        }
    } catch (Exception e) {
        log.error(ExceptionUtil.getStackTrace(e));
        throw new WebApplicationException(
                Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("View save failed.").build());
    }
    return new ReturnCodeBean(ReturnCodeBean.SUCCESS, "Saved");
}

From source file:org.opennms.netmgt.xml.eventconf.Logmsg.java

/**
 * Sets the value of field 'dest'.//from www. j  av  a  2s  .  com
 * 
 * @param dest the value of field 'dest'.
 */
public void setDest(final String dest) {
    this.m_dest = dest.intern();
}

From source file:com.qwazr.utils.cassandra.CassandraCluster.java

public CassandraSession getSession(String keySpace) {
    if (keySpace == null)
        return getSession();
    checkCluster();/*  w  ww .ja v  a  2  s .c  om*/
    keySpace = keySpace.intern();
    rwl.r.lock();
    try {
        CassandraSession session = sessions.get(keySpace);
        if (session != null)
            return session;
    } finally {
        rwl.r.unlock();
    }
    rwl.w.lock();
    try {
        CassandraSession session = sessions.get(keySpace);
        if (session != null)
            return session;
        session = new CassandraSession(cluster, keySpace);
        sessions.put(keySpace, session);
        return session;
    } finally {
        rwl.w.unlock();
    }
}

From source file:com.jaeksoft.searchlib.schema.SchemaField.java

/**
 * @param copyOf/*from w ww .  ja  v  a 2s .c om*/
 *            the copyOf to set
 */
public void setCopyOf(List<String> copyOf) {
    if (CollectionUtils.isEmpty(copyOf)) {
        this.copyOf = null;
    } else {
        this.copyOf = new ArrayList<String>(copyOf.size());
        for (String cf : copyOf)
            this.copyOf.add(cf.intern());
        setStored(Stored.NO);
    }
}

From source file:br.gov.jfrj.itextpdf.Documento.java

public static ArrayList<String> getAssinantesStringLista(Set<ExMovimentacao> movsAssinatura) {
    ArrayList<String> assinantes = new ArrayList<String>();
    for (ExMovimentacao movAssinatura : movsAssinatura) {
        String s = movAssinatura.getDescrMov().trim().toUpperCase();
        s = s.split(":")[0];
        s = s.intern();
        if (!assinantes.contains(s)) {
            assinantes.add(s);//from   ww  w  . j  a  v  a  2  s  .co m
        }
    }
    return assinantes;
}

From source file:hudson.maven.ModuleDependency.java

public ModuleDependency(String groupId, String artifactId, String version, boolean plugin) {
    this.groupId = groupId.intern();
    this.artifactId = artifactId.intern();
    if (version == null)
        this.version = UNKNOWN;
    else//from w  w w . ja  va 2s  . c o m
        this.version = version.intern();
    this.plugin = plugin;
}

From source file:com.netxforge.oss2.xml.event.Maskelement.java

/**
 * Sets the value of field 'mename'. The field 'mename' has the
 * following description: The mask element name can only be one
 * of those/*ww w  .  j  a v  a 2  s.  co m*/
 *  specified above
 * 
 * @param mename the value of field 'mename'.
 */
public void setMename(final java.lang.String mename) {
    this._mename = mename.intern();
}

From source file:org.apache.hadoop.hbase.regionserver.metrics.SchemaConfigured.java

/**
 * Used when we know table and column family name. If configuration is null,
 * {@link SchemaMetrics#configureGlobally(Configuration)} should have been
 * called already.//  w ww.  ja v a2  s . c om
 */
public SchemaConfigured(Configuration conf, String tableName, String cfName) {
    this(conf);
    this.tableName = tableName != null ? tableName.intern() : tableName;
    this.cfName = cfName != null ? cfName.intern() : cfName;
}