ACE-5052: close spring application context in EmailServer.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@125304 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2016-04-14 09:24:04 +00:00
parent bfb4c39628
commit 674dfb9570

View File

@@ -303,18 +303,8 @@ public abstract class EmailServer extends AbstractLifecycleBean
usage(); usage();
return; return;
} }
AbstractApplicationContext context = null;
try
{
context = new ClassPathXmlApplicationContext(args);
} catch (BeansException e)
{
System.err.println("Erro create context: " + e);
usage();
return;
}
try try (AbstractApplicationContext context = new ClassPathXmlApplicationContext(args))
{ {
if (!context.containsBean("emailServer")) if (!context.containsBean("emailServer"))
{ {
@@ -342,14 +332,14 @@ public abstract class EmailServer extends AbstractLifecycleBean
} }
} }
} }
catch (BeansException e)
{
System.err.println("Error creating context: " + e);
usage();
}
catch (InterruptedException e) catch (InterruptedException e)
{ {
} }
finally
{
context.close();
}
} }
private static void usage() private static void usage()