org.springframework.core.serializer.support.SerializationDelegate Java Examples
The following examples show how to use
org.springframework.core.serializer.support.SerializationDelegate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConcurrentMapCache.java From spring-analysis-note with MIT License | 5 votes |
private Object serializeValue(SerializationDelegate serialization, Object storeValue) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { serialization.serialize(storeValue, out); return out.toByteArray(); } finally { out.close(); } }
Example #2
Source File: ConcurrentMapCache.java From spring-analysis-note with MIT License | 5 votes |
private Object deserializeValue(SerializationDelegate serialization, Object storeValue) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream((byte[]) storeValue); try { return serialization.deserialize(in); } finally { in.close(); } }
Example #3
Source File: ConcurrentMapCacheManager.java From spring-analysis-note with MIT License | 5 votes |
@Override public void setBeanClassLoader(ClassLoader classLoader) { this.serialization = new SerializationDelegate(classLoader); // Need to recreate all Cache instances with new ClassLoader in store-by-value mode... if (isStoreByValue()) { recreateCaches(); } }
Example #4
Source File: ConcurrentMapCacheManager.java From spring-analysis-note with MIT License | 5 votes |
/** * Create a new ConcurrentMapCache instance for the specified cache name. * @param name the name of the cache * @return the ConcurrentMapCache (or a decorator thereof) */ protected Cache createConcurrentMapCache(String name) { SerializationDelegate actualSerialization = (isStoreByValue() ? this.serialization : null); return new ConcurrentMapCache(name, new ConcurrentHashMap<>(256), isAllowNullValues(), actualSerialization); }
Example #5
Source File: ConcurrentMapCache.java From java-technology-stack with MIT License | 5 votes |
private Object serializeValue(SerializationDelegate serialization, Object storeValue) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { serialization.serialize(storeValue, out); return out.toByteArray(); } finally { out.close(); } }
Example #6
Source File: ConcurrentMapCache.java From java-technology-stack with MIT License | 5 votes |
private Object deserializeValue(SerializationDelegate serialization, Object storeValue) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream((byte[]) storeValue); try { return serialization.deserialize(in); } finally { in.close(); } }
Example #7
Source File: ConcurrentMapCacheManager.java From java-technology-stack with MIT License | 5 votes |
@Override public void setBeanClassLoader(ClassLoader classLoader) { this.serialization = new SerializationDelegate(classLoader); // Need to recreate all Cache instances with new ClassLoader in store-by-value mode... if (isStoreByValue()) { recreateCaches(); } }
Example #8
Source File: ConcurrentMapCacheManager.java From java-technology-stack with MIT License | 5 votes |
/** * Create a new ConcurrentMapCache instance for the specified cache name. * @param name the name of the cache * @return the ConcurrentMapCache (or a decorator thereof) */ protected Cache createConcurrentMapCache(String name) { SerializationDelegate actualSerialization = (isStoreByValue() ? this.serialization : null); return new ConcurrentMapCache(name, new ConcurrentHashMap<>(256), isAllowNullValues(), actualSerialization); }
Example #9
Source File: ConcurrentMapCacheManager.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void setBeanClassLoader(ClassLoader classLoader) { this.serialization = new SerializationDelegate(classLoader); // Need to recreate all Cache instances with new ClassLoader in store-by-value mode... if (isStoreByValue()) { recreateCaches(); } }
Example #10
Source File: ConcurrentMapCacheManager.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Create a new ConcurrentMapCache instance for the specified cache name. * @param name the name of the cache * @return the ConcurrentMapCache (or a decorator thereof) */ protected Cache createConcurrentMapCache(String name) { SerializationDelegate actualSerialization = (isStoreByValue() ? this.serialization : null); return new ConcurrentMapCache(name, new ConcurrentHashMap<Object, Object>(256), isAllowNullValues(), actualSerialization); }
Example #11
Source File: ConcurrentMapCacheTests.java From spring-analysis-note with MIT License | 4 votes |
private ConcurrentMapCache createCacheWithStoreByValue() { return new ConcurrentMapCache(CACHE_NAME, this.nativeCache, true, new SerializationDelegate(ConcurrentMapCacheTests.class.getClassLoader())); }
Example #12
Source File: ConcurrentMapCacheTests.java From java-technology-stack with MIT License | 4 votes |
private ConcurrentMapCache createCacheWithStoreByValue() { return new ConcurrentMapCache(CACHE_NAME, this.nativeCache, true, new SerializationDelegate(ConcurrentMapCacheTests.class.getClassLoader())); }
Example #13
Source File: CustomConcurrentMapCache.java From entando-core with GNU Lesser General Public License v3.0 | 4 votes |
public CustomConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, boolean allowNullValues, SerializationDelegate serialization) { super(name, store, allowNullValues, serialization); }
Example #14
Source File: ConcurrentMapCache.java From spring-analysis-note with MIT License | 3 votes |
/** * Create a new ConcurrentMapCache with the specified name and the * given internal {@link ConcurrentMap} to use. If the * {@link SerializationDelegate} is specified, * {@link #isStoreByValue() store-by-value} is enabled * @param name the name of the cache * @param store the ConcurrentMap to use as an internal store * @param allowNullValues whether to allow {@code null} values * (adapting them to an internal null holder value) * @param serialization the {@link SerializationDelegate} to use * to serialize cache entry or {@code null} to store the reference * @since 4.3 */ protected ConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, boolean allowNullValues, @Nullable SerializationDelegate serialization) { super(allowNullValues); Assert.notNull(name, "Name must not be null"); Assert.notNull(store, "Store must not be null"); this.name = name; this.store = store; this.serialization = serialization; }
Example #15
Source File: ConcurrentMapCache.java From java-technology-stack with MIT License | 3 votes |
/** * Create a new ConcurrentMapCache with the specified name and the * given internal {@link ConcurrentMap} to use. If the * {@link SerializationDelegate} is specified, * {@link #isStoreByValue() store-by-value} is enabled * @param name the name of the cache * @param store the ConcurrentMap to use as an internal store * @param allowNullValues whether to allow {@code null} values * (adapting them to an internal null holder value) * @param serialization the {@link SerializationDelegate} to use * to serialize cache entry or {@code null} to store the reference * @since 4.3 */ protected ConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, boolean allowNullValues, @Nullable SerializationDelegate serialization) { super(allowNullValues); Assert.notNull(name, "Name must not be null"); Assert.notNull(store, "Store must not be null"); this.name = name; this.store = store; this.serialization = serialization; }
Example #16
Source File: ConcurrentMapCache.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Create a new ConcurrentMapCache with the specified name and the * given internal {@link ConcurrentMap} to use. If the * {@link SerializationDelegate} is specified, * {@link #isStoreByValue() store-by-value} is enabled * @param name the name of the cache * @param store the ConcurrentMap to use as an internal store * @param allowNullValues whether to allow {@code null} values * (adapting them to an internal null holder value) * @param serialization the {@link SerializationDelegate} to use * to serialize cache entry or {@code null} to store the reference * @since 4.3 */ protected ConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, boolean allowNullValues, SerializationDelegate serialization) { super(allowNullValues); Assert.notNull(name, "Name must not be null"); Assert.notNull(store, "Store must not be null"); this.name = name; this.store = store; this.serialization = serialization; }