Skip to content

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.List;
import java.util.Objects;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
Expand All @@ -31,7 +30,7 @@ public final class ExchangeInfo extends IgniteDiagnosticRequest.DiagnosticBaseIn
AffinityTopologyVersion topVer;

/**
* Empty constructor required by {@link GridIoMessageFactory}.
* Empty constructor required by {@link CoreMessagesProvider}.
*/
public ExchangeInfo() {
// No-op.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
import org.apache.ignite.maintenance.MaintenanceRegistry;
import org.apache.ignite.plugin.PluginNotFoundException;
import org.apache.ignite.plugin.PluginProvider;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;

/**
*
Expand Down Expand Up @@ -209,6 +210,13 @@ public interface GridKernalContext extends Iterable<GridComponent> {
*/
public MaintenanceRegistry maintenanceRegistry();

/**
* Gets core message factoy.
*
* @return Core message factory.
*/
public MessageFactory messageFactory();

/**
* Gets transformation processor.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
import org.apache.ignite.maintenance.MaintenanceRegistry;
import org.apache.ignite.plugin.PluginNotFoundException;
import org.apache.ignite.plugin.PluginProvider;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.jetbrains.annotations.Nullable;

import static org.apache.ignite.internal.IgniteComponentType.SPRING;
Expand Down Expand Up @@ -371,17 +372,14 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
private Thread.UncaughtExceptionHandler hnd;

/** */
private IgniteEx grid;
private IgniteKernal grid;

/** */
private IgniteConfiguration cfg;

/** */
private GridKernalGateway gw;

/** Network segmented flag. */
private volatile boolean segFlag;

/** Performance suggestions. */
private final GridPerformanceSuggestions perf = new GridPerformanceSuggestions();

Expand Down Expand Up @@ -430,7 +428,7 @@ public GridKernalContextImpl() {
@SuppressWarnings("TypeMayBeWeakened")
protected GridKernalContextImpl(
GridLoggerProxy log,
IgniteEx grid,
IgniteKernal grid,
IgniteConfiguration cfg,
GridKernalGateway gw,
List<PluginProvider> plugins,
Expand Down Expand Up @@ -614,18 +612,9 @@ else if (!(comp instanceof DiscoveryNodeValidationProcessor
comps.add(comp);
}

/**
* @param helper Helper to add.
*/
public void addHelper(Object helper) {
assert helper != null;

assert false : "Unknown helper class: " + helper.getClass();
}

/** {@inheritDoc} */
@Override public boolean isStopping() {
return ((IgniteKernal)grid).isStopping();
return grid.isStopping();
}

/** */
Expand Down Expand Up @@ -703,6 +692,11 @@ public void addHelper(Object helper) {
return maintenanceProc;
}

/** {@inheritDoc} */
@Override public MessageFactory messageFactory() {
return grid.messageFactory();
}

/** {@inheritDoc} */
@Override public CacheObjectTransformerProcessor transformer() {
return transProc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.jetbrains.annotations.Nullable;
Expand All @@ -49,7 +48,7 @@ public class IgniteDiagnosticRequest implements Message {
private final Map<Object, List<String>> msgs = new LinkedHashMap<>();

/**
* Default constructor required by {@link GridIoMessageFactory}.
* Default constructor required by {@link CoreMessagesProvider}.
*/
public IgniteDiagnosticRequest() {
// No-op.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.ignite.internal;

import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.jetbrains.annotations.Nullable;
Expand All @@ -33,7 +32,7 @@ public class IgniteDiagnosticResponse implements Message {
@Nullable String respInfo;

/**
* Default constructor required by {@link GridIoMessageFactory}.
* Default constructor required by {@link CoreMessagesProvider}.
*/
public IgniteDiagnosticResponse() {
// No-op.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager;
import org.apache.ignite.internal.managers.collision.GridCollisionManager;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl;
import org.apache.ignite.internal.managers.deployment.GridDeploymentManager;
import org.apache.ignite.internal.managers.discovery.DiscoveryLocalJoinData;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
Expand Down Expand Up @@ -209,6 +210,8 @@
import org.apache.ignite.plugin.IgnitePlugin;
import org.apache.ignite.plugin.PluginNotFoundException;
import org.apache.ignite.plugin.PluginProvider;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
import org.apache.ignite.spi.IgniteSpi;
import org.apache.ignite.spi.IgniteSpiVersionCheckException;
import org.apache.ignite.spi.discovery.isolated.IsolatedDiscoverySpi;
Expand Down Expand Up @@ -436,6 +439,9 @@ public class IgniteKernal implements IgniteEx, Externalizable {
/** The state object is used when reconnection occurs. See {@link IgniteKernal#onReconnected(boolean)}. */
private final ReconnectState reconnectState = new ReconnectState();

/** Core message factory. */
private MessageFactory msgFactory;

/**
* No-arg constructor is required by externalization.
*/
Expand Down Expand Up @@ -999,7 +1005,11 @@ public void start(
}
startManager(new GridMetricManager(ctx));
startManager(new GridSystemViewManager(ctx));

initMessageFactory();

startManager(new GridIoManager(ctx));

startManager(new GridCheckpointManager(ctx));

startManager(new GridEventStorageManager(ctx));
Expand Down Expand Up @@ -1301,6 +1311,31 @@ else if (e instanceof IgniteCheckedException)
startTimer.finishGlobalStage("Await exchange");
}

/** */
private void initMessageFactory() throws IgniteCheckedException {
MessageFactoryProvider[] msgs = ctx.plugins().extensions(MessageFactoryProvider.class);

if (msgs == null)
msgs = new MessageFactoryProvider[0];

List<MessageFactoryProvider> compMsgs = new ArrayList<>();

compMsgs.add(new CoreMessagesProvider(ctx.marshaller(), ctx.marshallerContext().jdkMarshaller(),
U.resolveClassLoader(ctx.config())));

for (IgniteComponentType compType : IgniteComponentType.values()) {
MessageFactoryProvider f = compType.messageFactory();

if (f != null)
compMsgs.add(f);
}

if (!compMsgs.isEmpty())
msgs = F.concat(msgs, compMsgs.toArray(new MessageFactoryProvider[compMsgs.size()]));

msgFactory = new IgniteMessageFactoryImpl(msgs);
}

/**
* @return Ignite security processor. See {@link IgniteSecurity} for details.
*/
Expand Down Expand Up @@ -3028,6 +3063,11 @@ private void checkClusterState() throws IgniteException {
}
}

/** @return Core message factory. */
MessageFactory messageFactory() {
return msgFactory;
}

/**
* Method is responsible for handling the {@link EventType#EVT_CLIENT_NODE_DISCONNECTED} event. Notify all the
* GridComponents that the such even has been occurred (e.g. if the local client node disconnected from the cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.HashSet;
import java.util.Objects;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
Expand All @@ -38,7 +37,7 @@ public final class TxEntriesInfo extends IgniteDiagnosticRequest.DiagnosticBaseI
Collection<KeyCacheObject> keys;

/**
* Empty constructor required by {@link GridIoMessageFactory}.
* Empty constructor required by {@link CoreMessagesProvider}.
*/
public TxEntriesInfo() {
// No-op.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.ignite.internal;

import java.util.Objects;
import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.U;
Expand All @@ -34,7 +33,7 @@ public final class TxInfo extends IgniteDiagnosticRequest.DiagnosticBaseInfo {
GridCacheVersion nearVer;

/**
* Empty constructor required by {@link GridIoMessageFactory}.
* Empty constructor required by {@link CoreMessagesProvider}.
*/
public TxInfo() {
// No-op.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteComponentType;
import org.apache.ignite.internal.IgniteDeploymentCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
Expand Down Expand Up @@ -129,7 +128,6 @@
import org.apache.ignite.metric.MetricRegistry;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
import org.apache.ignite.plugin.extensions.communication.MessageFormatter;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
Expand Down Expand Up @@ -254,9 +252,6 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Object>>
/** Received bytes count metric name. */
public static final String RCVD_BYTES_CNT = "ReceivedBytesCount";

/** Empty array of message factories. */
public static final MessageFactoryProvider[] EMPTY = {};

/** Max closed topics to store. */
public static final int MAX_CLOSED_TOPICS = 10240;

Expand Down Expand Up @@ -442,26 +437,7 @@ public void resetMetrics() {
};
}

MessageFactoryProvider[] msgs = ctx.plugins().extensions(MessageFactoryProvider.class);

if (msgs == null)
msgs = EMPTY;

List<MessageFactoryProvider> compMsgs = new ArrayList<>();

compMsgs.add(new GridIoMessageFactory(marsh, U.gridClassLoader()));

for (IgniteComponentType compType : IgniteComponentType.values()) {
MessageFactoryProvider f = compType.messageFactory();

if (f != null)
compMsgs.add(f);
}

if (!compMsgs.isEmpty())
msgs = F.concat(msgs, compMsgs.toArray(new MessageFactoryProvider[compMsgs.size()]));

msgFactory = new IgniteMessageFactoryImpl(msgs);
msgFactory = ctx.messageFactory();

CommunicationSpi<Object> spi = getSpi();

Expand Down
Loading
Loading