Skip to content

Commit

Permalink
IGNITE-24256 Fixed NullPointerException during stop of TcpDiscoveryMu…
Browse files Browse the repository at this point in the history
…lticastIpFinder. (#11823)
  • Loading branch information
petrov-mg authored Jan 20, 2025
1 parent a08bbfd commit 5464d35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ public TcpDiscoveryMulticastIpFinder setMulticastGroup(String mcastGrp) {
/** @param ignite Ignite instance. */
@IgniteInstanceResource
public void setIgnite(IgniteEx ignite) {
marsh = ignite.context().marshallerContext().jdkMarshaller();
if (ignite != null)
marsh = ignite.context().marshallerContext().jdkMarshaller();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.apache.ignite.spi.discovery.DiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;

Expand All @@ -47,6 +49,11 @@ public class TcpClientDiscoverySpiMulticastTest extends GridCommonAbstractTest {
/** */
private ThreadLocal<Integer> discoPort = new ThreadLocal<>();

/** */
private LogListener logLsnr = LogListener
.matches("Failed to remove injected resources from SPI")
.build();

/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
Expand Down Expand Up @@ -78,6 +85,12 @@ public class TcpClientDiscoverySpiMulticastTest extends GridCommonAbstractTest {

cfg.setDiscoverySpi(spi);

ListeningTestLogger listeningLog = new ListeningTestLogger(log);

listeningLog.registerListener(logLsnr);

cfg.setGridLogger(listeningLog);

return cfg;
}

Expand All @@ -86,6 +99,8 @@ public class TcpClientDiscoverySpiMulticastTest extends GridCommonAbstractTest {
super.afterTest();

stopAllGrids();

assertFalse(logLsnr.check());
}

/**
Expand Down

0 comments on commit 5464d35

Please sign in to comment.