Add comment clarifying property setting in client
This commit adds a comment clarifying why we do not catch a security exception in the pre-built transport client.
This commit is contained in:
parent
d5c18bf5c9
commit
5185a9734d
|
@ -37,13 +37,12 @@ import java.util.Collections;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A builder to create an instance of {@link TransportClient}
|
* A builder to create an instance of {@link TransportClient}. This class pre-installs the
|
||||||
* This class pre-installs the
|
|
||||||
* {@link Netty4Plugin},
|
* {@link Netty4Plugin},
|
||||||
* {@link ReindexPlugin},
|
* {@link ReindexPlugin},
|
||||||
* {@link PercolatorPlugin},
|
* {@link PercolatorPlugin},
|
||||||
* and {@link MustachePlugin}
|
* and {@link MustachePlugin}
|
||||||
* for the client. These plugins are all elasticsearch core modules required.
|
* plugins for the client. These plugins are all the required modules for Elasticsearch.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"unchecked","varargs"})
|
@SuppressWarnings({"unchecked","varargs"})
|
||||||
public class PreBuiltTransportClient extends TransportClient {
|
public class PreBuiltTransportClient extends TransportClient {
|
||||||
|
@ -63,6 +62,8 @@ public class PreBuiltTransportClient extends TransportClient {
|
||||||
final String noUnsafe = System.getProperty(noUnsafeKey);
|
final String noUnsafe = System.getProperty(noUnsafeKey);
|
||||||
if (noUnsafe == null) {
|
if (noUnsafe == null) {
|
||||||
// disable Netty from using unsafe
|
// disable Netty from using unsafe
|
||||||
|
// while permissions are needed to set this, if a security exception is thrown the permission needed can either be granted or
|
||||||
|
// the system property can be set directly before starting the JVM; therefore, we do not catch a security exception here
|
||||||
System.setProperty(noUnsafeKey, Boolean.toString(true));
|
System.setProperty(noUnsafeKey, Boolean.toString(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +71,8 @@ public class PreBuiltTransportClient extends TransportClient {
|
||||||
final String noKeySetOptimization = System.getProperty(noKeySetOptimizationKey);
|
final String noKeySetOptimization = System.getProperty(noKeySetOptimizationKey);
|
||||||
if (noKeySetOptimization == null) {
|
if (noKeySetOptimization == null) {
|
||||||
// disable Netty from replacing the selector key set
|
// disable Netty from replacing the selector key set
|
||||||
|
// while permissions are needed to set this, if a security exception is thrown the permission needed can either be granted or
|
||||||
|
// the system property can be set directly before starting the JVM; therefore, we do not catch a security exception here
|
||||||
System.setProperty(noKeySetOptimizationKey, Boolean.toString(true));
|
System.setProperty(noKeySetOptimizationKey, Boolean.toString(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,9 +85,9 @@ public class PreBuiltTransportClient extends TransportClient {
|
||||||
PercolatorPlugin.class,
|
PercolatorPlugin.class,
|
||||||
MustachePlugin.class));
|
MustachePlugin.class));
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new transport client with pre-installed plugins.
|
* Creates a new transport client with pre-installed plugins.
|
||||||
|
*
|
||||||
* @param settings the settings passed to this transport client
|
* @param settings the settings passed to this transport client
|
||||||
* @param plugins an optional array of additional plugins to run with this client
|
* @param plugins an optional array of additional plugins to run with this client
|
||||||
*/
|
*/
|
||||||
|
@ -93,9 +96,9 @@ public class PreBuiltTransportClient extends TransportClient {
|
||||||
this(settings, Arrays.asList(plugins));
|
this(settings, Arrays.asList(plugins));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new transport client with pre-installed plugins.
|
* Creates a new transport client with pre-installed plugins.
|
||||||
|
*
|
||||||
* @param settings the settings passed to this transport client
|
* @param settings the settings passed to this transport client
|
||||||
* @param plugins a collection of additional plugins to run with this client
|
* @param plugins a collection of additional plugins to run with this client
|
||||||
*/
|
*/
|
||||||
|
@ -105,11 +108,14 @@ public class PreBuiltTransportClient extends TransportClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new transport client with pre-installed plugins.
|
* Creates a new transport client with pre-installed plugins.
|
||||||
|
*
|
||||||
* @param settings the settings passed to this transport client
|
* @param settings the settings passed to this transport client
|
||||||
* @param plugins a collection of additional plugins to run with this client
|
* @param plugins a collection of additional plugins to run with this client
|
||||||
* @param hostFailureListener a failure listener that is invoked if a node is disconnected. This can be <code>null</code>
|
* @param hostFailureListener a failure listener that is invoked if a node is disconnected; this can be <code>null</code>
|
||||||
*/
|
*/
|
||||||
public PreBuiltTransportClient(Settings settings, Collection<Class<? extends Plugin>> plugins,
|
public PreBuiltTransportClient(
|
||||||
|
Settings settings,
|
||||||
|
Collection<Class<? extends Plugin>> plugins,
|
||||||
HostFailureListener hostFailureListener) {
|
HostFailureListener hostFailureListener) {
|
||||||
super(settings, Settings.EMPTY, addPlugins(plugins, PRE_INSTALLED_PLUGINS), hostFailureListener);
|
super(settings, Settings.EMPTY, addPlugins(plugins, PRE_INSTALLED_PLUGINS), hostFailureListener);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue