|
21 | 21 | import com.mongodb.MongoClientException; |
22 | 22 | import com.mongodb.MongoClientSettings; |
23 | 23 | import com.mongodb.connection.ClusterSettings; |
| 24 | +import com.mongodb.connection.SocketSettings; |
24 | 25 | import com.mongodb.crypt.capi.MongoAwsKmsProviderOptions; |
25 | 26 | import com.mongodb.crypt.capi.MongoCryptOptions; |
26 | 27 | import com.mongodb.crypt.capi.MongoLocalKmsProviderOptions; |
@@ -77,20 +78,32 @@ public static List<String> createMongocryptdSpawnArgs(final Map<String, Object> |
77 | 78 | spawnArgs.add("--idleShutdownTimeoutSecs"); |
78 | 79 | spawnArgs.add("60"); |
79 | 80 | } |
| 81 | + if (!spawnArgs.contains("--logpath")) { |
| 82 | + spawnArgs.add("--logappend"); |
| 83 | + spawnArgs.add("--logpath"); |
| 84 | + spawnArgs.add(System.getProperty("os.name").startsWith("Windows") ? "NUL" : "/dev/null"); |
| 85 | + } |
80 | 86 | return spawnArgs; |
81 | 87 | } |
82 | 88 |
|
83 | 89 | public static MongoClientSettings createMongocryptdClientSettings(final String connectionString) { |
84 | 90 |
|
85 | 91 | return MongoClientSettings.builder() |
86 | | - .applyConnectionString(new ConnectionString((connectionString != null) |
87 | | - ? connectionString : "mongodb://localhost:27020")) |
88 | 92 | .applyToClusterSettings(new Block<ClusterSettings.Builder>() { |
89 | 93 | @Override |
90 | 94 | public void apply(final ClusterSettings.Builder builder) { |
91 | 95 | builder.serverSelectionTimeout(1, TimeUnit.SECONDS); |
92 | 96 | } |
93 | 97 | }) |
| 98 | + .applyToSocketSettings(new Block<SocketSettings.Builder>() { |
| 99 | + @Override |
| 100 | + public void apply(final SocketSettings.Builder builder) { |
| 101 | + builder.readTimeout(1, TimeUnit.SECONDS); |
| 102 | + builder.connectTimeout(1, TimeUnit.SECONDS); |
| 103 | + } |
| 104 | + }) |
| 105 | + .applyConnectionString(new ConnectionString((connectionString != null) |
| 106 | + ? connectionString : "mongodb://localhost:27020")) |
94 | 107 | .build(); |
95 | 108 | } |
96 | 109 |
|
|
0 commit comments