Revision 9ee1ca44
Added by Andreas Müller almost 2 years ago
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF | ||
---|---|---|
186 | 186 |
net.sf.ehcache.config, |
187 | 187 |
net.sf.ehcache.statistics, |
188 | 188 |
net.sf.ehcache.store, |
189 |
net.sf.ehcache.util, |
|
189 | 190 |
net.sf.json;uses:="net.sf.json.processors,net.sf.json.util,org.apache.commons.lang.exception", |
190 | 191 |
org.aopalliance.aop, |
191 | 192 |
org.apache.commons.collections;uses:="org.apache.commons.collections.keyvalue,new org.apache.commons.collections", |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/RemoteInvocationTermCacher.java | ||
---|---|---|
23 | 23 |
import eu.etaxonomy.cdm.model.term.TermType; |
24 | 24 |
|
25 | 25 |
|
26 |
/** |
|
27 |
* Note by AM (2022-06-15): This caches terms. But it seems that only the method |
|
28 |
* "listByTermType" from term service is cached. |
|
29 |
*/ |
|
26 | 30 |
public class RemoteInvocationTermCacher implements IRemoteInvocationTermCacher { |
27 | 31 |
|
28 | 32 |
private static final Logger logger = LogManager.getLogger(RemoteInvocationTermCacher.class); |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/net/sf/ehcache/util/PreferredLoaderObjectInputStream.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright Terracotta, Inc. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
*/ |
|
16 |
|
|
17 |
package net.sf.ehcache.util; |
|
18 |
|
|
19 |
import java.io.IOException; |
|
20 |
import java.io.InputStream; |
|
21 |
import java.io.ObjectInputStream; |
|
22 |
import java.io.ObjectStreamClass; |
|
23 |
import java.util.HashMap; |
|
24 |
|
|
25 |
/** |
|
26 |
* Note by AM (2022-06-15): this is an exact copy of the same class in ehcache (v2.x) |
|
27 |
* but with correct handling for primitive types. |
|
28 |
* This class should be removed when upgrading to ehcache 3.x as it seems not to exist in |
|
29 |
* this version anymore. |
|
30 |
* |
|
31 |
* For further information see #10075 and #10077 |
|
32 |
* |
|
33 |
* ========================================= |
|
34 |
* Original javadoc: |
|
35 |
* |
|
36 |
* ObjectInputStream that uses a supplied classloader when resolving classes |
|
37 |
* |
|
38 |
* @author teck |
|
39 |
*/ |
|
40 |
public class PreferredLoaderObjectInputStream extends ObjectInputStream { |
|
41 |
|
|
42 |
private final ClassLoader loader; |
|
43 |
|
|
44 |
/** |
|
45 |
* Constructor |
|
46 |
* |
|
47 |
* @param in |
|
48 |
* @throws IOException |
|
49 |
*/ |
|
50 |
public PreferredLoaderObjectInputStream(InputStream in, ClassLoader loader) throws IOException { |
|
51 |
super(in); |
|
52 |
this.loader = loader; |
|
53 |
} |
|
54 |
|
|
55 |
// ************** REPLACED METHOD ********************************/ |
|
56 |
|
|
57 |
@Override |
|
58 |
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { |
|
59 |
|
|
60 |
try { |
|
61 |
return Class.forName(desc.getName(), false, loader); |
|
62 |
} catch (ClassNotFoundException ex) { |
|
63 |
Class<?> cl = primClasses.get(desc.getName()); |
|
64 |
if (cl != null) { |
|
65 |
return cl; |
|
66 |
} else { |
|
67 |
throw ex; |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
71 |
//copied from |
|
72 |
/** table mapping primitive type names to corresponding class objects */ |
|
73 |
private static final HashMap<String, Class<?>> primClasses |
|
74 |
= new HashMap<>(8, 1.0F); |
|
75 |
static { |
|
76 |
primClasses.put("boolean", boolean.class); |
|
77 |
primClasses.put("byte", byte.class); |
|
78 |
primClasses.put("char", char.class); |
|
79 |
primClasses.put("short", short.class); |
|
80 |
primClasses.put("int", int.class); |
|
81 |
primClasses.put("long", long.class); |
|
82 |
primClasses.put("float", float.class); |
|
83 |
primClasses.put("double", double.class); |
|
84 |
primClasses.put("void", void.class); |
|
85 |
} |
|
86 |
|
|
87 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/springframework/remoting/httpinvoker/CachingHttpInvokerProxyFactoryBean.java | ||
---|---|---|
89 | 89 |
RemoteInvocationResult invocationResult = doExecuteRequest(invocation, originalInvocation); |
90 | 90 |
if(invocationResult.getValue() != null && !invocationResult.hasException()) { |
91 | 91 |
|
92 |
//Note AM (2022-06-15): the debug information seem to be misleading (also because cache() is not used/implemented anymore) |
|
92 | 93 |
if(persistingMethods.contains(invocation.getMethodName())) { |
93 | 94 |
invocationResult = new RemoteInvocationResult(cdmEntitySessionManager().load(invocationResult.getValue(), true)); |
94 | 95 |
logger.debug("Entity cached with updating cached data"); |
Also available in: Unified diff
fix #10075 fix deserialization by overriding PreferredLoaderObjectInputStream from ehcache