Search in sources :

Example 1 with MetadataUpdateAcceptedMessage

use of org.apache.ignite.internal.processors.cache.binary.MetadataUpdateAcceptedMessage in project ignite by apache.

the class IgniteContinuousQueryMetadataUpdateTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TestTcpDiscoverySpi) cfg.getDiscoverySpi()).discoveryHook(new DiscoveryHook() {

        @Override
        public void beforeDiscovery(DiscoveryCustomMessage customMsg) {
            if (customMsg instanceof MetadataUpdateAcceptedMessage) {
                try {
                    U.sleep(50);
                } catch (IgniteInterruptedCheckedException e) {
                    fail("Unexpected error:" + e);
                }
            }
        }
    });
    cfg.setPeerClassLoadingEnabled(true);
    return cfg;
}
Also used : IgniteInterruptedCheckedException(org.apache.ignite.internal.IgniteInterruptedCheckedException) MetadataUpdateAcceptedMessage(org.apache.ignite.internal.processors.cache.binary.MetadataUpdateAcceptedMessage) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TestTcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) DiscoveryHook(org.apache.ignite.testframework.GridTestUtils.DiscoveryHook)

Example 2 with MetadataUpdateAcceptedMessage

use of org.apache.ignite.internal.processors.cache.binary.MetadataUpdateAcceptedMessage in project ignite by apache.

the class CacheRegisterMetadataLocallyTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setDiscoverySpi(new TcpDiscoverySpi() {

        @Override
        public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
            if (msg instanceof CustomMessageWrapper) {
                DiscoveryCustomMessage realMsg = ((CustomMessageWrapper) msg).delegate();
                if (realMsg instanceof MetadataUpdateProposedMessage || realMsg instanceof MetadataUpdateAcceptedMessage)
                    customMessages.add(realMsg);
            }
            super.sendCustomEvent(msg);
        }
    });
    cfg.setCommunicationSpi(new TcpCommunicationSpi() {

        @Override
        public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) throws IgniteSpiException {
            if (msg instanceof GridIoMessage)
                communicationMessages.add(((GridIoMessage) msg).message());
            super.sendMessage(node, msg, ackC);
        }

        @Override
        public void sendMessage(ClusterNode node, Message msg) throws IgniteSpiException {
            if (msg instanceof GridIoMessage)
                communicationMessages.add(((GridIoMessage) msg).message());
            super.sendMessage(node, msg);
        }
    });
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
    cfg.setCacheConfiguration(cacheConfiguration(STATIC_CACHE_NAME, StaticKey.class, StaticValue.class));
    return cfg;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) CustomMessageWrapper(org.apache.ignite.internal.managers.discovery.CustomMessageWrapper) MetadataUpdateAcceptedMessage(org.apache.ignite.internal.processors.cache.binary.MetadataUpdateAcceptedMessage) GridIoMessage(org.apache.ignite.internal.managers.communication.GridIoMessage) MetadataRequestMessage(org.apache.ignite.internal.processors.cache.binary.MetadataRequestMessage) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) MetadataUpdateProposedMessage(org.apache.ignite.internal.processors.cache.binary.MetadataUpdateProposedMessage) MetadataUpdateAcceptedMessage(org.apache.ignite.internal.processors.cache.binary.MetadataUpdateAcceptedMessage) GridIoMessage(org.apache.ignite.internal.managers.communication.GridIoMessage) DiscoverySpiCustomMessage(org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage) MetadataResponseMessage(org.apache.ignite.internal.processors.cache.binary.MetadataResponseMessage) Message(org.apache.ignite.plugin.extensions.communication.Message) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) DiscoverySpiCustomMessage(org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) MetadataUpdateProposedMessage(org.apache.ignite.internal.processors.cache.binary.MetadataUpdateProposedMessage) IgniteException(org.apache.ignite.IgniteException) IgniteSpiException(org.apache.ignite.spi.IgniteSpiException) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 DiscoveryCustomMessage (org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage)2 MetadataUpdateAcceptedMessage (org.apache.ignite.internal.processors.cache.binary.MetadataUpdateAcceptedMessage)2 IgniteException (org.apache.ignite.IgniteException)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 IgniteInterruptedCheckedException (org.apache.ignite.internal.IgniteInterruptedCheckedException)1 GridIoMessage (org.apache.ignite.internal.managers.communication.GridIoMessage)1 CustomMessageWrapper (org.apache.ignite.internal.managers.discovery.CustomMessageWrapper)1 MetadataRequestMessage (org.apache.ignite.internal.processors.cache.binary.MetadataRequestMessage)1 MetadataResponseMessage (org.apache.ignite.internal.processors.cache.binary.MetadataResponseMessage)1 MetadataUpdateProposedMessage (org.apache.ignite.internal.processors.cache.binary.MetadataUpdateProposedMessage)1 Message (org.apache.ignite.plugin.extensions.communication.Message)1 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)1 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)1 DiscoverySpiCustomMessage (org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage)1 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)1 TestTcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi)1 DiscoveryHook (org.apache.ignite.testframework.GridTestUtils.DiscoveryHook)1