Again - I would suggest that what you want is provided by the Transaction 
Control specification - you can begin a scope and then all work done within 
that scope remains isolated until the scope finishes.

It’s trivial to provide a resource provider for a service, which gives you the 
scoping that you want for that service. Resource providers already exist for 
JDBC and JPA, which may give you what you want out of the box already.


> On 19 Oct 2016, at 09:41, cniehues <christian.nieh...@its-telco.de> wrote:
> 
> I want to ensure that changes in the database/persistence-unit that have not
> been committed are only visible to the instances handling the same request.
> But the EntityManager is only an example, I am looking for something like a
> context singleton scope for service instances. Think about a service that
> will be used multiple times that has a longer running initiation process
> depending on the request content.
> Is there maybe a factory I can extend?
> 
> 
> 
> --
> View this message in context: 
> http://karaf.922171.n3.nabble.com/Best-practice-for-context-specific-service-instances-tp4048410p4048427.html
> Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to