@@ -38,10 +38,15 @@ public enum FileMode {
3838 * The default file mode. This maps the database to virtual memory. This
3939 * often provides similar performance to loading the database into real
4040 * memory without the overhead.
41+ *
42+ * <p>On Windows, a live memory mapping may prevent the database file
43+ * from being renamed, replaced, or deleted until the mapped buffer is
44+ * garbage collected.
4145 */
4246 MEMORY_MAPPED ,
4347 /**
44- * Loads the database into memory when the reader is constructed.
48+ * Loads the database into memory when the reader is constructed. This
49+ * avoids keeping a live memory mapping of the database file.
4550 */
4651 MEMORY
4752 }
@@ -240,11 +245,11 @@ long record = traverseResult[0];
240245 * in an IPv6 database. networks() iterates over the canonical locations and
241246 * not the aliases. To include the aliases, you can set includeAliasedNetworks to true.
242247 *
243- * @param <T> Represents the data type(e.g., Map, HastMap , etc.).
248+ * @param <T> Represents the data type(e.g., Map, HashMap , etc.).
244249 * @param typeParameterClass The type of data returned by the iterator.
245250 * @return Networks The Networks iterator.
246251 * @throws InvalidNetworkException Exception for using an IPv6 network in ipv4-only database.
247- * @throws ClosedDatabaseException Exception for a closed databased .
252+ * @throws ClosedDatabaseException Exception for a closed database .
248253 * @throws InvalidDatabaseException Exception for an invalid database.
249254 */
250255 public <T > Networks <T > networks (Class <T > typeParameterClass ) throws
@@ -259,11 +264,11 @@ public <T> Networks<T> networks(Class<T> typeParameterClass) throws
259264 * separately. To set the iteration over the IPv4 networks once, use the
260265 * includeAliasedNetworks option.
261266 *
262- * @param <T> Represents the data type(e.g., Map, HastMap , etc.).
267+ * @param <T> Represents the data type(e.g., Map, HashMap , etc.).
263268 * @param includeAliasedNetworks Enable including aliased networks.
264269 * @return Networks The Networks iterator.
265270 * @throws InvalidNetworkException Exception for using an IPv6 network in ipv4-only database.
266- * @throws ClosedDatabaseException Exception for a closed databased .
271+ * @throws ClosedDatabaseException Exception for a closed database .
267272 * @throws InvalidDatabaseException Exception for an invalid database.
268273 */
269274 public <T > Networks <T > networks (
@@ -326,13 +331,13 @@ private long findIpV4StartNode(Buffer buffer)
326331 * separately. To only iterate over the IPv4 networks once, use the
327332 * includeAliasedNetworks option.
328333 *
329- * @param <T> Represents the data type(e.g., Map, HastMap , etc.).
334+ * @param <T> Represents the data type(e.g., Map, HashMap , etc.).
330335 * @param network Specifies the network to be iterated.
331336 * @param includeAliasedNetworks Boolean for including aliased networks.
332337 * @param typeParameterClass The type of data returned by the iterator.
333338 * @return Networks
334339 * @throws InvalidNetworkException Exception for using an IPv6 network in ipv4-only database.
335- * @throws ClosedDatabaseException Exception for a closed databased .
340+ * @throws ClosedDatabaseException Exception for a closed database .
336341 * @throws InvalidDatabaseException Exception for an invalid database.
337342 */
338343 public <T > Networks <T > networksWithin (
@@ -497,10 +502,12 @@ public Metadata getMetadata() {
497502 * </p>
498503 * <p>
499504 * If you are using <code>FileMode.MEMORY_MAPPED</code>, this will
500- * <em>not</em> unmap the underlying file due to a limitation in Java's
501- * <code>MappedByteBuffer</code>. It will however set the reference to
502- * the buffer to <code>null</code>, allowing the garbage collector to
503- * collect it.
505+ * release this reader's reference to the mapped buffer, allowing the
506+ * garbage collector to collect it when no other references remain. Java
507+ * does not provide a supported way to unmap a
508+ * <code>MappedByteBuffer</code> immediately. On Windows, this means the
509+ * database file may remain unavailable for rename, replacement, or
510+ * deletion until the mapped buffer is garbage collected.
504511 * </p>
505512 *
506513 * @throws IOException if an I/O error occurs.
0 commit comments