Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Jackson Core Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Core Source Code files are provided in the source packge (jackson-core-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Core Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/core/util/InternCache.java
package com.fasterxml.jackson.core.util; import java.util.concurrent.ConcurrentHashMap; /** * Singleton class that adds a simple first-level cache in front of * regular String.intern() functionality. This is done as a minor * performance optimization, to avoid calling native intern() method * in cases where same String is being interned multiple times. *<p> * Note: that this class extends {@link java.util.LinkedHashMap} is an implementation * detail -- no code should ever directly call Map methods. */ public final class InternCache extends ConcurrentHashMap<String,String> // since 2.3 { private static final long serialVersionUID = 1L; /** * Size to use is somewhat arbitrary, so let's choose something that's * neither too small (low hit ratio) nor too large (waste of memory). *<p> * One consideration is possible attack via colliding {@link String#hashCode}; * because of this, limit to reasonably low setting. */ private final static int MAX_ENTRIES = 180; public final static InternCache instance = new InternCache(); /** * As minor optimization let's try to avoid "flush storms", * cases where multiple threads might try to concurrently * flush the map. */ private final Object lock = new Object(); private InternCache() { super(MAX_ENTRIES, 0.8f, 4); } public String intern(String input) { String result = get(input); if (result != null) { return result; } /* 18-Sep-2013, tatu: We used to use LinkedHashMap, which has simple LRU * method. No such functionality exists with CHM; and let's use simplest * possible limitation: just clear all contents. This because otherwise * we are simply likely to keep on clearing same, commonly used entries. */ if (size() >= MAX_ENTRIES) { /* Not incorrect wrt well-known double-locking anti-pattern because underlying * storage gives close enough answer to real one here; and we are * more concerned with flooding than starvation. */ synchronized (lock) { if (size() >= MAX_ENTRIES) { clear(); } } } result = input.intern(); put(result, result); return result; } }
⏎ com/fasterxml/jackson/core/util/InternCache.java
Or download all of them as a single archive file:
File name: jackson-core-2.14.0-sources.jar File size: 497693 bytes Release date: 2022-11-05 Download
⇒ Download and Install Jackson Binary Package
2016-02-03, 47747👍, 1💬
Popular Posts:
The Jakarta-ORO Java classes are a set of text-processing Java classes that provide Perl5 compatible...
JDK 11 java.desktop.jmod is the JMOD file for JDK 11 Desktop module. JDK 11 Desktop module compiled ...
xml-commons External Source Code Files are provided in the source package file, xml-commons-external...
What Is poi-3.5.jar - Part 2? poi-3.5.jar is one of the JAR files for Apache POI 3.5, which provides...
What JAR files are required to run sax\Writer.java provided in the Apache Xerces package? 1 JAR file...