intern

deadlock on synchronized ( String intern())

I user sun jdk 1.5 ThreadPoolExecutor( 24, 24,60,TimeUnit.SECONDS, new LinkedBlockingQueue()). soemtime I use jdb tool to find the status of all threads in thread pool are " waiting in a monitor", the code is : String key = getKey(dt.getPrefix(), id); synchronized (key.intern()) { -----> Is there a problem in "synchronized (...

When to use intern()

I see a lot of legacy code like this: class A { public static final String CONSTANT = "value".intern(); ... } I don't see any reason for the intern(), as in the Javadoc one can read: "All literal strings and string-valued constant expressions are interned." Is there some intent of this, maybe in past revisions of the language?...

Use PermGen space or roll-my-own intern method?

I am writing a Codec to process messages sent over TCP using a bespoke wire protocol. During the decode process I create a number of Strings, BigDecimals and dates. The client-server access patterns mean that it is common for the client to issue a request and then decode thousands of response messages, which results in a large number o...

How is Java's String#intern() method implemented?

I tried to look at Java's String#intern() method, but it's public native String intern(); In general, how is interning implemented? In String's case? ...

Generic InternPool<T> in Java?

How would I write a generic InternPool<T> in Java? Does it need a Internable interface? String in Java has interning capabilities; I want to intern classes like BigDecimal and Account. ...

How do I get an web application deveopment intern?

I was wondering if anyone knew the easiest way for a start up company to get interns. With limited resources it is the start up companies that need these internships the most. I read several articles on internships and most advise to choose smaller start up companies to intern at. I was wondering how to attract and obtain such interns. ...