Add ability to disable options in specific bindings, use it to disable callbacks on external threads in java
This commit is contained in:
parent
1ef77ef99a
commit
b19611010a
|
@ -94,7 +94,8 @@ public abstract class AbstractTester {
|
|||
if (!args.useExternalClient()) {
|
||||
throw new IllegalArgumentException("Cannot enable callbacks on external thread without using external client");
|
||||
}
|
||||
fdb.options().setCallbacksOnExternalThreads();
|
||||
throw new IllegalArgumentException("Cannot enable callbacks on external thread in Java");
|
||||
//fdb.options().setCallbacksOnExternalThreads();
|
||||
}
|
||||
if (args.useExternalClient()) {
|
||||
fdb.options().setDisableLocalClient();
|
||||
|
|
|
@ -82,7 +82,8 @@ description is not currently required but encouraged.
|
|||
<Option name="disable_multi_version_client_api" code="60"
|
||||
description="Disables the multi-version client API and instead uses the local client directly. Must be set before setting up the network." />
|
||||
<Option name="callbacks_on_external_threads" code="61"
|
||||
description="If set, callbacks from external client libraries can be called from threads created by the FoundationDB client library. Otherwise, callbacks will be called from either the thread used to add the callback or the network thread. Setting this option can improve performance when connected using an external client, but may not be safe to use in all environments. Must be set before setting up the network." />
|
||||
description="If set, callbacks from external client libraries can be called from threads created by the FoundationDB client library. Otherwise, callbacks will be called from either the thread used to add the callback or the network thread. Setting this option can improve performance when connected using an external client, but may not be safe to use in all environments. Must be set before setting up the network."
|
||||
disableOn="java" />
|
||||
<Option name="external_client_library" code="62"
|
||||
paramType="String" paramDescription="path to client library"
|
||||
description="Adds an external client library for use by the multi-version client API. Must be set before setting up the network." />
|
||||
|
|
|
@ -168,7 +168,6 @@ namespace vexillographer
|
|||
|
||||
private static void writePredicateClass(TextWriter outFile, Scope scope, IEnumerable<Option> options)
|
||||
{
|
||||
string className = scope.ToString() + "s";
|
||||
outFile.WriteLine(
|
||||
@"package com.apple.cie.foundationdb;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace vexillographer
|
|||
}
|
||||
|
||||
IEnumerable<Option> options;
|
||||
int result = parseOptions(args[0], out options);
|
||||
int result = parseOptions(args[0], out options, args[1]);
|
||||
if (result != 0)
|
||||
return result;
|
||||
|
||||
|
@ -117,7 +117,7 @@ namespace vexillographer
|
|||
Environment.GetCommandLineArgs()[0]);
|
||||
}
|
||||
|
||||
private static int parseOptions(string path, out IEnumerable<Option> options)
|
||||
private static int parseOptions(string path, out IEnumerable<Option> options, string binding)
|
||||
{
|
||||
|
||||
var list = new List<Option>();
|
||||
|
@ -133,17 +133,27 @@ namespace vexillographer
|
|||
var paramTypeStr = oDoc.AttributeOrNull("paramType");
|
||||
ParamType p = paramTypeStr == null ? ParamType.None : (ParamType)Enum.Parse(typeof(ParamType), paramTypeStr);
|
||||
bool hidden = oDoc.AttributeOrNull("hidden") == "true";
|
||||
string disableOn = oDoc.AttributeOrNull("disableOn");
|
||||
bool disabled = false;
|
||||
if(disableOn != null)
|
||||
{
|
||||
string[] disabledBindings = disableOn.Split(',');
|
||||
disabled = disabledBindings.Contains(binding);
|
||||
}
|
||||
|
||||
list.Add(new Option
|
||||
{
|
||||
scope = s,
|
||||
name = oDoc.AttributeNonNull("name"),
|
||||
code = int.Parse(oDoc.AttributeNonNull("code")),
|
||||
paramType = p,
|
||||
paramDesc = oDoc.AttributeOrNull("paramDescription"),
|
||||
comment = oDoc.AttributeOrNull("description"),
|
||||
hidden = hidden
|
||||
});
|
||||
if (!disabled)
|
||||
{
|
||||
list.Add(new Option
|
||||
{
|
||||
scope = s,
|
||||
name = oDoc.AttributeNonNull("name"),
|
||||
code = int.Parse(oDoc.AttributeNonNull("code")),
|
||||
paramType = p,
|
||||
paramDesc = oDoc.AttributeOrNull("paramDescription"),
|
||||
comment = oDoc.AttributeOrNull("description"),
|
||||
hidden = hidden
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
options = list;
|
||||
|
|
Loading…
Reference in New Issue