Special Considerations for Joining a Space or Metaspace

A single process can connect to a given metaspace or join a given space only when the following conditions are met:

  • A single application can only connect once to the same metaspace. In other words, you cannot invoke connect on the same metaspace twice and have two connections to the same metaspace from the same process. However, you can connect simultaneously to several different metaspaces, and it is possible to get a copy of a currently connected metaspace object by using the ASCommon object's methods.
  • When a process joins a space through its metaspace connection, it will only join a space once. If you call getSpace twice, the process will join the space the first time you call it, but the second getSpace call will return to you a new reference to the previously created space object. If you specify a different role the second time you call getSpace, then it will adjust your role on that space, but this does not mean that you have joined the same space twice.
  • The space object is reference-counted and the space will actually be left by the process only when the space object's leave method is invoked an equal number of times to the Metaspace's getSpace method for that particular space.

    The role on the space (seeder or leech) is also automatically adjusted when leave methods are being invoked on those space objects.

Related reference