Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Disabled network loader by default in AdminClient.

  • Loading branch information...
commit 233e2d0dd3699fbfad285d2bfdbfc579786191bd 1 parent 8942921
@bbansal bbansal authored
View
44 src/java/voldemort/server/VoldemortConfig.java
@@ -116,6 +116,7 @@
private boolean enableServerRouting;
private boolean enableMetadataChecking;
private boolean enableRedirectRouting;
+ private boolean enableNetworkClassLoader;
private List<String> storageConfigurations;
@@ -128,23 +129,6 @@
private int adminStreamBufferSize;
private int adminSocketTimeout;
private int adminConnectionTimeout;
-
- public int getAdminSocketTimeout() {
- return adminSocketTimeout;
- }
-
- public void setAdminSocketTimeout(int adminSocketTimeout) {
- this.adminSocketTimeout = adminSocketTimeout;
- }
-
- public int getAdminConnectionTimeout() {
- return adminConnectionTimeout;
- }
-
- public void setAdminConnectionTimeout(int adminConnectionTimeout) {
- this.adminConnectionTimeout = adminConnectionTimeout;
- }
-
private int streamMaxReadBytesPerSec;
private int streamMaxWriteBytesPerSec;
@@ -270,6 +254,9 @@ public VoldemortConfig(Props props) {
RequestFormatType.VOLDEMORT_V1.getCode());
this.requestFormatType = RequestFormatType.fromCode(requestFormatName);
+ // network class loader disable by default.
+ this.enableNetworkClassLoader = props.getBoolean("enable.network.classloader", false);
+
validateParams();
}
@@ -904,6 +891,22 @@ public void setRetentionCleanupScheduledPeriodInHour(int retentionCleanupSchedul
this.retentionCleanupScheduledPeriodInHour = retentionCleanupScheduledPeriodInHour;
}
+ public int getAdminSocketTimeout() {
+ return adminSocketTimeout;
+ }
+
+ public void setAdminSocketTimeout(int adminSocketTimeout) {
+ this.adminSocketTimeout = adminSocketTimeout;
+ }
+
+ public int getAdminConnectionTimeout() {
+ return adminConnectionTimeout;
+ }
+
+ public void setAdminConnectionTimeout(int adminConnectionTimeout) {
+ this.adminConnectionTimeout = adminConnectionTimeout;
+ }
+
public String getReadOnlySearchStrategy() {
return readOnlySearchStrategy;
}
@@ -912,4 +915,11 @@ public void setReadOnlySearchStrategy(String readOnlySearchStrategy) {
this.readOnlySearchStrategy = readOnlySearchStrategy;
}
+ public boolean isNetworkClassLoaderEnabled() {
+ return enableNetworkClassLoader;
+ }
+
+ public void setEnableNetworkClassLoader(boolean enableNetworkClassLoader) {
+ this.enableNetworkClassLoader = enableNetworkClassLoader;
+ }
}
View
23 src/java/voldemort/server/protocol/admin/ProtoBuffAdminServiceRequestHandler.java
@@ -473,14 +473,21 @@ public boolean isCompleteRequest(ByteBuffer buffer) {
/* Private helper methods */
private VoldemortFilter getFilterFromRequest(VAdminProto.VoldemortFilter request) {
VoldemortFilter filter;
- byte[] classBytes = ProtoUtils.decodeBytes(request.getData()).get();
- String className = request.getName();
-
- try {
- Class<?> cl = networkClassLoader.loadClass(className, classBytes, 0, classBytes.length);
- filter = (VoldemortFilter) cl.newInstance();
- } catch(Exception e) {
- throw new VoldemortException("Failed to load and instantiate the filter class", e);
+ if(voldemortConfig.isNetworkClassLoaderEnabled()) {
+ byte[] classBytes = ProtoUtils.decodeBytes(request.getData()).get();
+ String className = request.getName();
+
+ try {
+ Class<?> cl = networkClassLoader.loadClass(className,
+ classBytes,
+ 0,
+ classBytes.length);
+ filter = (VoldemortFilter) cl.newInstance();
+ } catch(Exception e) {
+ throw new VoldemortException("Failed to load and instantiate the filter class", e);
+ }
+ } else {
+ throw new VoldemortException("NetworkLoader is experimental and disabled by default.");
}
return filter;
View
3  test/common/voldemort/utils/ServerJVMTestUtils.java
@@ -133,7 +133,8 @@ public static String createAndInitializeVoldemortHome(int node,
+ "server.properties");
FileUtils.writeLines(serverProperties, Arrays.asList("node.id=" + node,
"bdb.cache.size=" + 1024 * 1024,
- "enable.metadata.checking=" + false));
+ "enable.metadata.checking=" + false,
+ "enable.network.classloader=" + true));
return config.getVoldemortHome();
}
View
2  test/unit/voldemort/client/AdminServiceFilterTest.java
@@ -59,6 +59,8 @@ public void setUp() throws IOException {
.getAbsolutePath(),
null,
storesXmlfile);
+ config.setEnableNetworkClassLoader(true);
+
server = new VoldemortServer(config, cluster);
server.start();
Please sign in to comment.
Something went wrong with that request. Please try again.