{"action":"created","issue":{"url":"https://api.github.com/repos/jankotek/mapdb/issues/549","labels_url":"https://api.github.com/repos/jankotek/mapdb/issues/549/labels{/name}","comments_url":"https://api.github.com/repos/jankotek/mapdb/issues/549/comments","events_url":"https://api.github.com/repos/jankotek/mapdb/issues/549/events","html_url":"https://github.com/jankotek/mapdb/issues/549","id":95379883,"number":549,"title":"Could DB make or get ?","user":{"login":"bwzhang2011","id":749788,"avatar_url":"https://avatars.githubusercontent.com/u/749788?v=3","gravatar_id":"","url":"https://api.github.com/users/bwzhang2011","html_url":"https://github.com/bwzhang2011","followers_url":"https://api.github.com/users/bwzhang2011/followers","following_url":"https://api.github.com/users/bwzhang2011/following{/other_user}","gists_url":"https://api.github.com/users/bwzhang2011/gists{/gist_id}","starred_url":"https://api.github.com/users/bwzhang2011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwzhang2011/subscriptions","organizations_url":"https://api.github.com/users/bwzhang2011/orgs","repos_url":"https://api.github.com/users/bwzhang2011/repos","events_url":"https://api.github.com/users/bwzhang2011/events{/privacy}","received_events_url":"https://api.github.com/users/bwzhang2011/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-16T08:31:47Z","updated_at":"2015-07-16T22:13:38Z","closed_at":null,"body":"@jankotek, as we use dbMaker to create db associated with either memory one or file based one.\r\nas for the file one, the current use cases need us to create the mapdb (just mean the DB instance) many times. just like the application will generate daily file and I will create the mapdb instance based on the daily file. so here comes my doubt, if I could not set the db instance to be the global one, I should get the DB (or open such exists) due to whether the file exists or not. so I dare Maker class should leave us such to open the exists file for DB creation. what's more, I notice that HTreeMapMaker  to  create the HTreeMap with makeOrGet(). so how could I generate the HTreeMap based on different file. here comes some use cases:\r\n```\r\npublic class AbstractMonitorCompositeStoreImpl extends MapStoreAdapter<String, MonitorComposite>\r\n\t\timplements IMonitorCompositeStore {\r\n\t@Override\r\n\tpublic void store(final String key, final MonitorComposite value) {\r\n\r\n\t}\r\n\r\n\t@Override\r\n\tpublic MonitorComposite load(final String key) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic Set<String> loadAllKeys() {\r\n\t\treturn null;\r\n\t}\r\n\r\n}\r\n```\r\njust like the mapstore (from hazelcast) I want to persist the object MonitorComposite  into mapdb with special key. and I want to generate many files based the key with some configuration just like\r\nparentpath/date/db.data    the date change daily and each time when it invoke store I will load the DB according to the key (just for HTreeMap creation) and then store value afterwards."},"comment":{"url":"https://api.github.com/repos/jankotek/mapdb/issues/comments/122119429","html_url":"https://github.com/jankotek/mapdb/issues/549#issuecomment-122119429","issue_url":"https://api.github.com/repos/jankotek/mapdb/issues/549","id":122119429,"user":{"login":"jankotek","id":359021,"avatar_url":"https://avatars.githubusercontent.com/u/359021?v=3","gravatar_id":"","url":"https://api.github.com/users/jankotek","html_url":"https://github.com/jankotek","followers_url":"https://api.github.com/users/jankotek/followers","following_url":"https://api.github.com/users/jankotek/following{/other_user}","gists_url":"https://api.github.com/users/jankotek/gists{/gist_id}","starred_url":"https://api.github.com/users/jankotek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jankotek/subscriptions","organizations_url":"https://api.github.com/users/jankotek/orgs","repos_url":"https://api.github.com/users/jankotek/repos","events_url":"https://api.github.com/users/jankotek/events{/privacy}","received_events_url":"https://api.github.com/users/jankotek/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T22:13:38Z","updated_at":"2015-07-16T22:13:38Z","body":"> 1) MapDB docs should state clearly \r\n\r\nDocumentation will follow soon\r\n\r\n>  2) open the same file is made MapDB should at least throw an error or warning \r\n\r\nI just added exclusive file locking to master branch, beta-3 should block multiple DB instances over single file. See #305. \r\n\r\n`FileChannel.lock()` is not best, so I am going to add second optional locking method based on Lock file with heartbeat. It works very well for H2 database.\r\n\r\n> 3) Regardless of sharing, I'd like to know the proper way to fully flush DB writes (for a mmap'd file) in preparation for copying the file, without shutting down the JVM.\r\n\r\nClosing DB should be enough. Also `DB.commit()` should work if there are no writes until copying finishes. When transactions are disabled the `DB.commit()` will sync write cache to disk, so files should be consistent until next write.\r\n\r\nI will keep this issue open until documentation is updated.\r\n"}}