kirklund commented on a change in pull request #6746:
URL: https://github.com/apache/geode/pull/6746#discussion_r691627247
##########
File path:
geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeRedisSerializablesIntegrationTest.java
##########
@@ -25,7 +28,7 @@ protected String getModuleName() {
}
@Override
- protected Class getModuleClass() {
- return GeodeRedisService.class;
+ protected Class<?> getModuleClass() {
+ return RedisSanctionedSerializablesService.class;
Review comment:
Note: Use class that implements SanctionedSerializablesService instead
of unrelated GeodeRedisService.
##########
File path:
geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
##########
@@ -657,20 +649,6 @@ public MemoryAllocator getOffHeapStore() {
return offHeapStore;
}
- /**
- * Initialize any services that provided as extensions to the cache using
the service loader
- * mechanism.
- */
- private void initializeServices() {
- ServiceLoader<DistributedSystemService> loader =
- ServiceLoader.load(DistributedSystemService.class);
- for (DistributedSystemService service : loader) {
- service.init(this);
- services.put(service.getInterface(), service);
- }
- }
-
-
Review comment:
Note: Moved to SanctionedSerializables class in geode-serialization.
##########
File path:
geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
##########
@@ -192,11 +189,6 @@
private final GrantorRequestProcessor.GrantorRequestContext grc;
- /**
- * services provided by other modules
- */
- private Map<Class, DistributedSystemService> services = new HashMap<>();
-
Review comment:
Note: This Map was written to but never read. It was unused.
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
##########
@@ -374,10 +393,21 @@ public static String processOutgoingClassName(final
String nameArg, DataOutput o
* DistributionConfig
*
* @param distributionConfig the DistributedSystem configuration
- * @param services DistributedSystem services that might have classes to
acceptlist
*/
- public static void initialize(DistributionConfig distributionConfig,
- Collection<DistributedSystemService> services) {
+ public static void initializeSerializationFilter(DistributionConfig
distributionConfig) {
+ initializeSerializationFilter(distributionConfig,
loadSanctionedSerializablesServices());
+ }
Review comment:
Note: loadSanctionedSerializablesServices() is in
SanctionedSerializables in geode-serialization.
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
##########
@@ -397,30 +427,6 @@ private static void clearSerializationFilter() {
serializationFilter = defaultSerializationFilter;
}
- /**
- * {@link DistributedSystemService}s that need to acceptlist Serializable
objects can use this to
- * read them from a file and then return them via
- * {@link DistributedSystemService#getSerializationAcceptlist}
- */
- public static Collection<String> loadClassNames(URL sanctionedSerializables)
throws IOException {
- ArrayList<String> result = new ArrayList<>(1000);
- try (InputStream inputStream = sanctionedSerializables.openStream();
- InputStreamReader reader = new InputStreamReader(inputStream);
- BufferedReader in = new BufferedReader(reader)) {
- String line;
- while ((line = in.readLine()) != null) {
- line = line.trim();
- if (!(line.startsWith("#") || line.startsWith("//"))) {
- line = line.replaceAll("/", ".");
- result.add(line.substring(0, line.indexOf(',')));
- }
- }
- }
- // logger.info("loaded {} class names from {}", result.size(),
sanctionedSerializables);
- return result;
-
- }
-
Review comment:
Note: Moved to SanctionedSerializables in geode-serialization.
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/ObjectInputStreamFilterWrapper.java
##########
@@ -81,25 +81,6 @@ public ObjectInputStreamFilterWrapper(String
serializationFilterSpec,
}
}
- try {
- URL sanctionedSerializables = ClassPathLoader.getLatest()
- .getResource(InternalDataSerializer.class,
"sanctioned-geode-core-serializables.txt");
- Collection<String> coreClassNames =
- InternalDataSerializer.loadClassNames(sanctionedSerializables);
-
- URL sanctionedManagementSerializables = ClassPathLoader.getLatest()
- .getResource(InternalDataSerializer.class,
- "sanctioned-geode-management-serializables.txt");
- Collection<String> managmentClassNames =
-
InternalDataSerializer.loadClassNames(sanctionedManagementSerializables);
-
- sanctionedClasses.addAll(coreClassNames);
- sanctionedClasses.addAll(managmentClassNames);
- } catch (IOException e) {
- throw new InternalGemFireException(
- "unable to read sanctionedSerializables.txt to form a serialization
acceptlist", e);
- }
-
Review comment:
Note: This special-case section is no longer needed.
CoreSanctionedSerializablesService now exists in geode-core so that the
above for-loop loads "sanctioned-geode-core-serializables.txt".
ManagementSanctionedSerializablesService now exists in geode-management so
that the above for-loop loads "sanctioned-geode-management-serializables.txt".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]