How do I get rid of the Thread and ContainerBackgroundProcessor objects 
associated with a StandardEngine after finishing a JUnit test, so several of 
them don't accumulate and hog all my machine's resources?

I'm testing out a SOAP service on several different platforms, so it seemed 
natural to automate it with JUnit.  I put the following code snippets in my 
Test class:

declaration:
                StandardEngine se = null;

then later... 

        @Before
        public void setUp() throws Exception {
                if (se == null) {
                        se = new StandardEngine();
                        FRTLJDBCRealm r = new FRTLJDBCRealm();
                        r.setDriverName("org.hsqldb.jdbcDriver");
                        r.setConnectionURL("jdbc:hsqldb:hsql://localhost");
                        r.setUserTable("user");
                        r.setUserNameCol("user_name");
                        r.setUserCredCol("user_pass");
                        r.setUserRoleTable("user");
                        r.setRoleNameCol("role_name");
                        r.setConnectionName("sa");
                        r.setConnectionPassword("sXU7DMFjs8zr");
                        se.setRealm(r);
                        se.start();
                }
                ... other stuff ...
        }


So this works pretty well, it connects me to the database and my JUnit test can 
do things with the database permissions of "someuser".

When the test completes, I want to tear it down.  I tried:

        @After
        public void tearDown() throws Exception {
                System.out.println("tearDown");
                se.destroy();
                se = null;
        }

but there is still a Thread running a ContainerBackgroundProcessor running in 
the background which prevents the garbage collector from throwing out my 
StandardEngine se object.  How can I just get rid of everything in the 
tearDown() method?  Or is there a better way?


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to