Multiple connections, metaspace connection managment and connection pool/connection factory availability in ActiveSpaces.

Multiple connections, metaspace connection managment and connection pool/connection factory availability in ActiveSpaces.

book

Article ID: KB0093654

calendar_today

Updated On:

Products Versions
TIBCO ActiveSpaces -
Not Applicable -

Description

Resolution:

A process can only connect once to the same metaspace. When you try to connect a second time, the exception "TIBAS_SYS_ERROR metaspace_already_exists" is thrown. Use ASCommon.getMetaspace() to get a copy of the already valid metaspace object . A single process can only connect once to a specific metaspace, so if you call Metaspace.Connect() twice in a row you will get the error described. Since the Java process already has the Metaspace defined as a resource, it is already connected to it. You can do a Metaspace.getSpace() call as many times as you want however but don't forget to do a close on the space object you get, as the space object is reference counted.


You can call Metaspace.connect() only once per process per metaspace name, they can leverage ASCommon.getMetaspace(String metaspaceName) to avoid the problem (if already connected that call will return a valid Metaspace object, otherwise null (in which case you can call Metaspace.connect()).

There is no connection pool/connection factory available in ActiveSpaces. The easiest approach is to create new threads for each request. You can initially connect to AS cluster during the start-up procedure (one time). For each thread, you can share the same Metaspace reference. The Metaspace object is thread safe.


Issue/Introduction

Multiple connections, metaspace connection managment and connection pool/connection factory availability in ActiveSpaces.

Additional Information