DS-2831 connections cleanup, context reuse (master)

This commit is contained in:
Arnaud de Bossoreille
2015-10-29 13:51:06 +01:00
parent 868120dda4
commit cb34855f20
3 changed files with 16 additions and 7 deletions

View File

@@ -292,16 +292,21 @@ public class EventServiceImpl implements EventService
{ {
Context ctx = new Context(); Context ctx = new Context();
Dispatcher dispatcher = pooledDispatcher.getObject(); try {
Dispatcher dispatcher = pooledDispatcher.getObject();
for (Iterator ci = dispatcher.getConsumers() for (Iterator ci = dispatcher.getConsumers()
.iterator(); ci.hasNext();) .iterator(); ci.hasNext();)
{
ConsumerProfile cp = (ConsumerProfile) ci.next();
if (cp != null)
{ {
cp.getConsumer().finish(ctx); ConsumerProfile cp = (ConsumerProfile) ci.next();
if (cp != null)
{
cp.getConsumer().finish(ctx);
}
} }
} catch (Exception e) {
ctx.abort();
throw e;
} }
} }

View File

@@ -628,6 +628,8 @@ public class BitstreamResource extends Resource
log.trace("Deleting bitstream from all bundles."); log.trace("Deleting bitstream from all bundles.");
bitstreamService.delete(context, dspaceBitstream); bitstreamService.delete(context, dspaceBitstream);
context.complete();
} }
catch (SQLException e) catch (SQLException e)
{ {

View File

@@ -518,6 +518,8 @@ public class CollectionsResource extends Resource
collectionService.delete(context, dspaceCollection); collectionService.delete(context, dspaceCollection);
collectionService.update(context, dspaceCollection); collectionService.update(context, dspaceCollection);
context.complete();
} }
catch (ContextException e) catch (ContextException e)
{ {