The close Method

Your application can leave a space by invoking the space object's close() method (Java API), by calling the tibasSpace_Free() function (C API), or by stopping the listeners or browsers that may have joined the space automatically when created.

Because the space object is reference-counted, when created from a metaspace object, the space will actually be left by the process only when the space object's close() method is invoked an equal number of times to the metaspace's getSpace method for that particular space. Just as the application’s distribution role in the space can be adjusted by subsequent calls to getSpace with different roles, the application’s distribution role in the space is adjusted when close() is invoked on the instances of the Space object returned by each call to getSpace.

If browsers or listeners were created and not terminated when close() was invoked, the process does not leave the space until the browsers or listeners are terminated. You can forcefully leave the space and terminate any existing browsers and listeners on the space by invoking the closeAll() method.

Related reference