[hibernate-dev] [OGM] Managing GridDialect via the service registry

Gunnar Morling gunnar at hibernate.org
Tue Dec 17 03:50:46 EST 2013


Hi,

We currently have a custom mechanism for providing the current GridDialect
to components and I'm wondering about the motivation for this mechanism.

More specifically there is GridDialectFactory which instantiates the
dialect type and DatastoreServices which provides access to this instance.
So we have two services and initiators just dealing with providing access
to the current grid dialect.

Couldn't there simply be a GridDialectInitiator which instantiates the
GridDialect type and registers the dialect itself as service in the
registry? This seems beneficial to me:

* GridDialect implementations can leverage all benefits of being a service,
e.g. they can implement Configurable to access the configuration or
ServiceRegistryAwareService to access other services (including the
DatastoreProvider). Note that GridDialect extends Service already today
which seems confusing as it is no service managed by the registry.
* We could remove DatastoreProvider, GridDialectFactory and their initiators
* One indirection less for users of the GridDialect as they can get it
directly from the registry

Any thoughts? Is there a specific reason for the current design which I'm
missing?

Thanks,

--Gunnar


More information about the hibernate-dev mailing list