Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)

125304 mward: ACE-5052: close spring application context in EmailServer.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125437 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-04-15 12:13:32 +00:00
parent 14d4cb8166
commit f12308b25d

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()