[jira] [Commented] (DELTASPIKE-848) EntityManagerFactory is not closed on disposal

2015-03-05 Thread Sven Linstaedt (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14348772#comment-14348772
 ] 

Sven Linstaedt commented on DELTASPIKE-848:
---

IMHO the rule for streams should also apply here: The one who creates it is 
responsible for closing it.

If I create an EMF by 
{code}
@Inject
@PersistenceUnitName(foo)
InstanceEMF instance;

EMF emf = instance.get();
// use lifecycle of emf...
instance.destroy(emf);
{code}
emf won't be closed, but is instead leaking. afaik this is a regular use case 
for @Dependent scoped beans. 

Besides: Having something like the following in 
{{EntityManagerFactoryProducer}} does not hurt, if the application has decided 
to close the EMF on their own and will prevent EMF leakage for sure.
{code}
void disposeEntityManagerFactory(@Disposes EntityManagerFactory factory) {
if (factory.isOpen()) {
factory.close();
}
}
{code}

 EntityManagerFactory is not closed on disposal
 --

 Key: DELTASPIKE-848
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-848
 Project: DeltaSpike
  Issue Type: Bug
Affects Versions: 1.2.1
Reporter: Sven Linstaedt

 {{org.apache.deltaspike.jpa.impl.entitymanager.EntityManagerFactoryProducer}} 
 does produces EntityManagerFactory, but it does not implement a disposal 
 method, which closes the factory on destruction, causing any underlying 
 SesionFactories to leak.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DELTASPIKE-848) EntityManagerFactory is not closed on disposal

2015-03-05 Thread Thomas Andraschko (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14348742#comment-14348742
 ] 

Thomas Andraschko commented on DELTASPIKE-848:
--

Woudln't it be safer if we would close it?

 EntityManagerFactory is not closed on disposal
 --

 Key: DELTASPIKE-848
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-848
 Project: DeltaSpike
  Issue Type: Bug
Affects Versions: 1.2.1
Reporter: Sven Linstaedt

 {{org.apache.deltaspike.jpa.impl.entitymanager.EntityManagerFactoryProducer}} 
 does produces EntityManagerFactory, but it does not implement a disposal 
 method, which closes the factory on destruction, causing any underlying 
 SesionFactories to leak.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)