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.wso2.andes.kernel.slot.SlotManagerStandalone.java

/**
 * Delete slot details when slot is empty. (All the messages are delivered and acknowledgments are
 * returned )//from  ww  w  .  j  a  v  a2  s.  c o m
 *
 * @param queueName       Name of the queue
 * @param slotToBeDeleted Slot to be deleted
 * @return Whether deleted or not
 */
public boolean deleteSlot(String queueName, Slot slotToBeDeleted) {
    String lockKey = queueName + SlotManagerStandalone.class;
    synchronized (lockKey.intern()) {
        TreeSet<Slot> assignedSlotSet = slotAssignmentMap.get(queueName);
        if (null != assignedSlotSet) {
            Iterator assignedSlotIterator = assignedSlotSet.iterator();
            while (assignedSlotIterator.hasNext()) {
                Slot assignedSlot = (Slot) assignedSlotIterator.next();
                if (assignedSlot.getEndMessageId() == slotToBeDeleted.getEndMessageId()) {
                    assignedSlotIterator.remove();
                    break;
                }
            }

        }
    }
    return true;
}

From source file:com.opensearchserver.extractor.parser.Audio.java

@Override
protected void parseContent(InputStream inputStream, String extension, String mimeType) throws Exception {
    String format = getParameterValue(FORMAT, 0);
    if (StringUtils.isEmpty(format))
        format = extension;// w ww.j  av  a  2 s  . com
    if (StringUtils.isEmpty(format) && mimeType != null)
        format = MIMEMAP.get(mimeType.intern());
    if (StringUtils.isEmpty(format))
        throw new Exception("The format is not found");
    File tempFile = ParserAbstract.createTempFile(inputStream, '.' + format);
    try {
        parseContent(tempFile, extension, mimeType);
    } finally {
        tempFile.delete();
    }
}

From source file:net.sf.firemox.action.UserAction.java

/**
 * Creates a new instance of UserAction <br>
 * //w  w w. j  a  va  2 s .  c  o m
 * @param debugData
 *          debug information.
 * @param actionName
 *          the action's name.
 */
protected UserAction(String actionName, String debugData) {
    super(debugData);
    if (actionName != null) {
        if (actionName.length() == 0) {
            this.actionName = null;
        } else {
            this.actionName = actionName.intern();
        }
    }
    ActionFactory.currentAction = this;
}

From source file:org.wso2.andes.kernel.slot.SlotManagerStandalone.java

/**
 * Get a slot by giving the queue name./*from   w ww  . jav  a2  s .c o  m*/
 *
 * @param queueName Name of the queue
 * @return Slot object
 */
public Slot getSlot(String queueName) {
    Slot slotToBeAssigned;
    String lockKey = queueName + SlotManagerStandalone.class;
    synchronized (lockKey.intern()) {
        //First look at slots which are returned when last subscriber leaves
        slotToBeAssigned = getUnassignedSlot(queueName);
        if (null == slotToBeAssigned) {
            slotToBeAssigned = getFreshSlot(queueName);
            if (log.isDebugEnabled()) {
                log.debug("Slot Manager - giving a slot from fresh pool. Slot= " + slotToBeAssigned);
            }
        }
        if (null == slotToBeAssigned) {
            if (log.isDebugEnabled()) {
                log.debug("Slot Manager - returns empty slot for the queue: " + queueName);
            }
        } else {
            updateSlotAssignmentMap(queueName, slotToBeAssigned);
        }
        return slotToBeAssigned;
    }
}

From source file:org.wso2.andes.kernel.slot.SlotManagerStandalone.java

/**
 * Record Slot's last message ID related to a particular queue
 *
 * @param queueName              Name of the queue which this message ID belongs to
 * @param lastMessageIdInTheSlot Last message ID of the slot
 *///from  w  w w . j a  v a  2s .co m
public void updateMessageID(String queueName, Long lastMessageIdInTheSlot) {

    TreeSet<Long> messageIdSet = slotIDMap.get(queueName);
    if (messageIdSet == null) {
        messageIdSet = new TreeSet<>();
    }
    String lockKey = queueName + SlotManagerStandalone.class;
    synchronized (lockKey.intern()) {
        /**
         * Update the slotIDMap
         */
        messageIdSet.add(lastMessageIdInTheSlot);

        slotIDMap.put(queueName, messageIdSet);
        if (log.isDebugEnabled()) {
            log.debug(
                    lastMessageIdInTheSlot + " added to slotIdMap. Current values in " + "map " + messageIdSet);
        }

    }

}

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

public SchemaField(String name, Stored stored, Indexed indexed, TermVector termVector, String analyzer,
        String... copyOf) {//from   w  ww  . jav a2  s  .com
    super(name);
    this.indexAnalyzer = analyzer == null ? null : analyzer.intern();
    this.stored = stored;
    this.indexed = indexed;
    this.termVector = termVector;
    this.copyOf = copyOf != null && copyOf.length > 0 ? Arrays.asList(copyOf) : null;
}

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

/**
 * //from   w  w  w  .  j  a  va2  s.c  o m
 * 
 * @param index
 * @param vMevalue
 * @throws java.lang.IndexOutOfBoundsException if the index
 * given is outside the bounds of the collection
 */
public void addMevalue(final int index, final java.lang.String vMevalue)
        throws java.lang.IndexOutOfBoundsException {
    this._mevalueList.add(index, vMevalue.intern());
}

From source file:edu.cornell.med.icb.geo.tools.ClassificationTask.java

public void setConditionName(final int conditionIndex, final String name) {
    conditionDescriptors[conditionIndex].conditionName = name.intern();
}

From source file:org.opennms.netmgt.config.datacollection.Rrd.java

/**
 * Sets the value of '_rraList' by copying the given Vector.
 * All elements will be checked for type safety.
 * //ww  w  .j a v a2 s  . c om
 * @param rras the Vector to copy.
 */
public void setRra(final List<String> rras) {
    m_rras.clear();
    for (final String rra : rras) {
        m_rras.add(rra.intern());
    }
}

From source file:org.opennms.netmgt.config.datacollection.Rrd.java

/**
 * Sets the value of '_rraList' by setting it to the given
 * Vector. No type checking is performed.
 * @deprecated//from   w  w  w.  j av a2  s .c o  m
 * 
 * @param rras the Vector to set.
 */
public void setRraCollection(final List<String> rras) {
    m_rras = new ArrayList<String>();
    for (final String rra : rras) {
        m_rras.add(rra.intern());
    }
}