Skip to content

Instantly share code, notes, and snippets.

@vietj
Last active August 27, 2015 14:18
Show Gist options
  • Save vietj/ce95942ee38a5906c93e to your computer and use it in GitHub Desktop.
Save vietj/ce95942ee38a5906c93e to your computer and use it in GitHub Desktop.
shared VertxOptions toVertxOptions(JsonObject json) {
Integer? blockedThreadCheckInterval = json.getIntegerOrNull("blockedThreadCheckInterval");
String? clusterHost = json.getStringOrNull("clusterHost");
Integer? clusterPingInterval = json.getIntegerOrNull("clusterPingInterval");
Integer? clusterPingReplyInterval = json.getIntegerOrNull("clusterPingReplyInterval");
Integer? clusterPort = json.getIntegerOrNull("clusterPort");
Boolean? clustered = json.getBooleanOrNull("clustered");
Integer? eventLoopPoolSize = json.getIntegerOrNull("eventLoopPoolSize");
Boolean? haEnabled = json.getBooleanOrNull("haEnabled");
String? haGroup = json.getStringOrNull("haGroup");
Integer? internalBlockingPoolSize = json.getIntegerOrNull("internalBlockingPoolSize");
Integer? maxEventLoopExecuteTime = json.getIntegerOrNull("maxEventLoopExecuteTime");
Integer? maxWorkerExecuteTime = json.getIntegerOrNull("maxWorkerExecuteTime");
MetricsOptions? metricsOptions;
if (exists tmp = json.getObjectOrNull("metricsOptions")) {
metricsOptions = toMetricsOptions(tmp);
} else {
metricsOptions = null;
}
Integer? quorumSize = json.getIntegerOrNull("quorumSize");
Integer? warningExceptionTime = json.getIntegerOrNull("warningExceptionTime");
Integer? workerPoolSize = json.getIntegerOrNull("workerPoolSize");
return VertxOptions {
blockedThreadCheckInterval = blockedThreadCheckInterval;
clusterHost = clusterHost;
clusterPingInterval = clusterPingInterval;
clusterPingReplyInterval = clusterPingReplyInterval;
clusterPort = clusterPort;
clustered = clustered;
eventLoopPoolSize = eventLoopPoolSize;
haEnabled = haEnabled;
haGroup = haGroup;
internalBlockingPoolSize = internalBlockingPoolSize;
maxEventLoopExecuteTime = maxEventLoopExecuteTime;
maxWorkerExecuteTime = maxWorkerExecuteTime;
metricsOptions = metricsOptions;
quorumSize = quorumSize;
warningExceptionTime = warningExceptionTime;
workerPoolSize = workerPoolSize;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment