Skip to end of metadata
Go to start of metadata

GumTree promotes the use of service oriented programming style to make application more maintainable. A service in the GumTree Platform is simply a POJO (Plain Old Java Object) that has a well definied interface. Each service is usually inject a single instance into the runtime, and make it available for use to the rest of the system. This is considered to be a better programming practice than using the singleton pattern.

There are many ways to inject a service into OSGi (the runtime kernel of GumTree), they included OSGi, Declarative Service, Spring DM IoC, etc. GumTree provides a convenience way to inject services programmatically, using the helper class org.gumtree.core.util.ServiceRegistrationManager.

For example, to register a service in the Activator, try:

Strickly speaking all registered services should be disposed automatically by OSGi, but it is a good practice to remove them manually to avoid memory leak.

References:

Labels
  • None