我在我的src.main.resources文件夹中创建了application.conf:
datastax-java-driver {
basic {
request {
default-idempotence = true
timeout = 5
}
}
advanced {
connection {
max-requests-per-connection = 32767
}
}
}这些只是一些测试属性,我认为没有应用这些属性,因为当我在调试器中查看时,默认值是不变的。
有什么想法可能会发生什么,或者我如何检查是否应用了自定义属性?
发布于 2020-10-15 13:01:19
如果您使用Maven,那么您已经正确地将其放在了src/main/resources文件夹中。否则,它需要放在应用程序类路径中。
发布于 2020-10-15 22:01:24
@ThatHansel,
您是否可以显示与下面类似的输出,以了解您从程序中获得的值?
我有一个利用DataStax Java Driver 4.9.0的样例类,并且我正在打印值。我在此演示中使用的是默认设置。
import java.net.InetSocketAddress;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.config.DefaultDriverOption;
public class DriverConfigsDemo {
public static void main(String... args) {
try (CqlSession session = CqlSession.builder().addContactPoint(new InetSocketAddress("localhost", 9042))
.withLocalDatacenter("dc1").build()) {// update to match your environment
System.out.println("Driver Configs - Idempotence: " + session.getContext().getConfig().getDefaultProfile().getString(DefaultDriverOption.REQUEST_DEFAULT_IDEMPOTENCE));
System.out.println("Driver Configs - Timeout: " + session.getContext().getConfig().getDefaultProfile().getDuration(DefaultDriverOption.REQUEST_TIMEOUT));
}
}
}当我运行这个程序时,我得到了下面的结果,你也应该在你的例子中看到类似的东西(即幂等为真,超时为PT5S),
09:56:10.019 [main] INFO c.d.o.d.i.c.DefaultMavenCoordinates - DataStax Java driver for Apache Cassandra(R) (com.datastax.oss:java-driver-core) version 4.9.0
09:56:10.574 [s0-admin-0] INFO c.d.o.d.internal.core.time.Clock - Using native clock for microsecond precision
Driver Configs - Idempotence: false
Driver Configs - Timeout: PT2Shttps://stackoverflow.com/questions/64363794
复制相似问题