List of usage examples for java.lang String intern
public native String intern();
From source file:org.dataconservancy.dcs.ingest.util.SeadElmSipStager.java
@Override public void updateSIP(Dcp sip, String id) { synchronized (id.intern()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); modelBuilder.buildSip((ResearchObject) sip, out); }//from w w w .j a v a2 s . c om }
From source file:org.pitest.testapi.Description.java
private String internIfNotNull(final String string) { if (string == null) { return null; }/*from ww w . ja va 2 s. co m*/ return string.intern(); }
From source file:org.blockartistry.DynSurround.client.fx.BlockEffect.java
public void setConditions(@Nullable final String conditions) { this.conditions = conditions == null ? StringUtils.EMPTY : conditions.intern(); }
From source file:org.dataconservancy.dcs.ingest.services.util.ElmSipStager.java
public void updateSIP(Dcp sip, String key) { synchronized (key.intern()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); modelBuilder.buildSip(sip, out); entityStore.put(key, new ByteArrayInputStream(out.toByteArray())); }//from ww w . j a v a2 s . c o m }
From source file:org.dataconservancy.dcs.ingest.util.SeadElmSipStager.java
public void updateSIP(ResearchObject sip, String key) { synchronized (key.intern()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); modelBuilder.buildSip(sip, out); entityStore.put(key, new ByteArrayInputStream(out.toByteArray())); }/* w w w.j a v a 2s . co m*/ }
From source file:org.quartz.impl.jdbcjobstore.DBSemaphore.java
/** * Determine whether the calling thread owns a lock on the identified * resource.//from w w w . j a v a 2 s. c o m */ public boolean isLockOwner(Connection conn, String lockName) { lockName = lockName.intern(); return getThreadLocks().contains(lockName); }
From source file:com.qwazr.utils.json.DirectoryJsonManager.java
private Pair<Long, T> put(String name, long lastModified, T instance) { name = name.intern(); Pair<Long, T> item = Pair.of(lastModified, instance); instancesMap.put(name, item);//w w w . j ava 2 s .c o m return item; }
From source file:org.quartz.impl.jdbcjobstore.SimpleSemaphore.java
/** * Grants a lock on the identified resource to the calling thread (blocking * until it is available)./*from www . j av a2 s.c om*/ * * @return true if the lock was obtained. */ public synchronized boolean obtainLock(Connection conn, String lockName) { lockName = lockName.intern(); Log log = getLog(); if (log.isDebugEnabled()) { log.debug("Lock '" + lockName + "' is desired by: " + Thread.currentThread().getName()); } if (!isLockOwner(conn, lockName)) { if (log.isDebugEnabled()) { log.debug("Lock '" + lockName + "' is being obtained: " + Thread.currentThread().getName()); } while (locks.contains(lockName)) { try { this.wait(); } catch (InterruptedException ie) { if (log.isDebugEnabled()) { log.debug( "Lock '" + lockName + "' was not obtained by: " + Thread.currentThread().getName()); } } } if (log.isDebugEnabled()) { log.debug("Lock '" + lockName + "' given to: " + Thread.currentThread().getName()); } getThreadLocks().add(lockName); locks.add(lockName); } else if (log.isDebugEnabled()) { log.debug("Lock '" + lockName + "' already owned by: " + Thread.currentThread().getName() + " -- but not owner!", new Exception("stack-trace of wrongful returner")); } return true; }
From source file:com.qwarz.graph.model.GraphNode.java
private Set<String> getEdgeSet(String type) { if (type == null || type.isEmpty()) return null; type = type.intern(); if (edges == null) edges = new LinkedHashMap<String, Set<String>>(); Set<String> nodeIdSet = edges.get(type); if (nodeIdSet != null) return nodeIdSet; nodeIdSet = new TreeSet<String>(); edges.put(type, nodeIdSet);//from w ww .ja v a 2 s .com return nodeIdSet; }
From source file:Profiler.java
/** * Notifies the profiler that a routine has ended * //from w ww . jav a 2 s . co m * @param name * The name of the routine */ public void stopRoutine(String name) { name = name.intern(); int i; for (i = 1; i < theRoutines.length && name != theRoutines[i]; i++) ; if (i == theRoutines.length || theRoutineStartTimes[i] < 0) throw new IllegalStateException("Routine " + name + " is already finished or has not been started"); long time = System.currentTimeMillis(); theRoutineProfiles[i] += time - theRoutineStartTimes[i]; theRoutineStartTimes[i] = -1; for (i = 1; i < theRoutines.length && theRoutineStartTimes[i] < 0; i++) ; if (i == theRoutines.length) theRoutineStartTimes[0] = time; }