Skip to content

Commit fe0168f

Browse files
committed
CID-1116546 Fix resource leak
1 parent e1d4a32 commit fe0168f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

usage/src/com/cloud/usage/UsageServer.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.apache.log4j.Logger;
2626
import org.apache.log4j.PropertyConfigurator;
2727
import org.apache.log4j.xml.DOMConfigurator;
28-
import org.springframework.context.ApplicationContext;
2928
import org.springframework.context.support.ClassPathXmlApplicationContext;
3029
import org.springframework.util.Log4jConfigurer;
3130

@@ -36,7 +35,8 @@ public class UsageServer implements Daemon {
3635
private static final Logger s_logger = Logger.getLogger(UsageServer.class.getName());
3736
public static final String Name = "usage-server";
3837

39-
UsageManager mgr;
38+
private UsageManager mgr;
39+
private ClassPathXmlApplicationContext appContext;
4040

4141
/**
4242
* @param args
@@ -54,7 +54,8 @@ public void init(DaemonContext arg0) throws DaemonInitException, Exception {
5454

5555
@Override
5656
public void start() {
57-
ApplicationContext appContext = new ClassPathXmlApplicationContext("usageApplicationContext.xml");
57+
58+
appContext = new ClassPathXmlApplicationContext("usageApplicationContext.xml");
5859

5960
try {
6061
ComponentContext.initComponentsLifeCycle();
@@ -73,7 +74,7 @@ public void start() {
7374

7475
@Override
7576
public void stop() {
76-
77+
appContext.close();
7778
}
7879

7980
@Override

0 commit comments

Comments
 (0)