palashc commented on code in PR #2539:
URL: https://github.com/apache/phoenix/pull/2539#discussion_r3445585511
##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/ServerCachingEndpointImpl.java:
##########
@@ -68,10 +71,15 @@ public void addServerCache(RpcController controller,
AddServerCacheRequest reque
request.hasTxState() ? request.getTxState().toByteArray() :
ByteUtil.EMPTY_BYTE_ARRAY;
try {
- @SuppressWarnings("unchecked")
- Class<ServerCacheFactory> serverCacheFactoryClass =
- (Class<ServerCacheFactory>)
Class.forName(request.getCacheFactory().getClassName());
- ServerCacheFactory cacheFactory = serverCacheFactoryClass.newInstance();
+ String factoryClassName = request.getCacheFactory().getClassName();
+ ServerCacheFactory cacheFactory;
+ if (HashCacheFactory.class.getName().equals(factoryClassName)) {
+ cacheFactory = new HashCacheFactory();
+ } else if
(IndexMetaDataCacheFactory.class.getName().equals(factoryClassName)) {
+ cacheFactory = new IndexMetaDataCacheFactory();
+ } else {
+ throw new DoNotRetryIOException("Disallowed ServerCacheFactory class:
" + factoryClassName);
Review Comment:
nit: is it possible to add a test for this branch?
--
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]