0 votes
asked in MicroStream Serialization & Communication by (1k points)

I know I can just delete the directory. But is there a programmatically way to lets say do something like...



I am just trying a little tool to use MicroStream for deep copying Objects through the (unfortunately not yet standalone available) MicroStream serialization. The idea is:

- create datastore

- save file

- shutdown and restart datastore (so that the object is not loaded from the jvm memory)

- load object

- destroy the datastore and return the deep copy

In this example I didnt find a way to destroy "old" datastores in a API like way.

2 Answers

0 votes
answered by (9.7k points)
selected by
Best answer
Currently there is no special API available to delete a storage. You can use the standard java API to delete the storage files and directories after you shut down the old storage.
Please be aware the storage must not contain lazy references if you create deep copies this way.
0 votes
answered by (590 points)

I tried to use java.io.file..
I assume it should also be possible to do this by an other way, but this was for me the shortest way to do it

private void btnDelDB_onClick(final ClickEvent<Button> event)
		// final dataRoot root = dbHandler.getRoot();
		final EmbeddedStorageManager storage = EmbeddedStorage.start();
		final dataRoot               root    = (dataRoot)storage.root();
		final File DBstorage = new File("C:/RC_MS_WS/FinMgmt/database");
		System.out.println("deleted database");

		final File bckStorage = new File("C:/RC_MS_WS/FinMgmt/databaseBck");
		System.out.println("deleted backup");

	catch(final Exception e)
		this.textAeraSysout.setValue("btnDelDB_onClick: generated error \n" + e.toString());


commented by (1k points)
Thanks for your post. And sure, its possible this way. But I wonder if there are also plans for an API delete. For the cases where you use microstream as a fast temporary database for ...whatever you wanna do and then delete it again. :)
commented by (1k points)

Hm I was double checking the page for a release date for standalone serialization. And noticed I didnt yet try 


and the stuff mentioned here:https://microstream.one/serialization

Maybe thats another thing I have to check for deep copy instead of using the full microsteam datastore.

Notes: Every question must be a separate forum post. Headline: Formulate your question shortly and precisely. Thank you!
Powered by Question2Answer