You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Sergey Nuyanzin (JIRA)" <ji...@apache.org> on 2018/04/28 14:31:00 UTC

[jira] [Comment Edited] (IGNITE-8158) Missed cleanups if afterTestsStop throws exception

    [ https://issues.apache.org/jira/browse/IGNITE-8158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16457631#comment-16457631 ] 

Sergey Nuyanzin edited comment on IGNITE-8158 at 4/28/18 2:30 PM:
------------------------------------------------------------------

Hello [~Mmuzaf]
 could I pick up this issue if you do not mind?

+ could you please clarify.

Is it enough just wrap afterTestsStopped e.g.
{code:java}
try { 
   afterTestsStopped(); 
}
catch (Exception e) {
   error("Exception while afterTestsStopped: ", e);
}
{code}
or would it be reasonable first do all cleanups and then fail the test if an exception happens inside afterTestsStopped ?


was (Author: sergey nuyanzin):
Hello [~Mmuzaf]
could I pick up this issue if you do not mind?

+ could you please clarify.

Is it enough just wrap afterTestsStopped e.g. \{code}

{color:#000080}try {color}{
 afterTestsStopped();
}{color:#000080}catch {color}(Exception {color:#0e8a30}e{color}){
 error({color:#008000}"Exception while afterTestsStopped: "{color}, {color:#0e8a30}e{color});
}\{code}
or would it be reasonable first do all cleanups and then fail the test if an exception happens inside afterTestsStopped ?

> Missed cleanups if afterTestsStop throws exception
> --------------------------------------------------
>
>                 Key: IGNITE-8158
>                 URL: https://issues.apache.org/jira/browse/IGNITE-8158
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Maxim Muzafarov
>            Priority: Minor
>              Labels: newbie, test
>             Fix For: 2.6
>
>
> Method {{afterTestsStopped}} might throw exception. Contibutor should provide solution for ensuring that all cleanups in {{tearDown}} method would be executed in this case.
> {code:java|title=GridAbstractTest.java}
>     /** {@inheritDoc} */
>     @Override protected void tearDown() throws Exception {
>         ...
>         try {
>             afterTest();
>         }
>         finally {
>             serializedObj.clear();
>             if (isLastTest()) {
>                 ...
>                 afterTestsStopped();
>                 if (startGrid)
>                     G.stop(getTestIgniteInstanceName(), true);
>                 // Remove counters.
>                 tests.remove(getClass());
>                 // Remove resources cached in static, if any.
>                 GridClassLoaderCache.clear();
>                 U.clearClassCache();
>                 MarshallerExclusions.clearCache();
>                 BinaryEnumCache.clear();
>             }
>             Thread.currentThread().setContextClassLoader(clsLdr);
>             clsLdr = null;
>             cleanReferences();
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)