Skip to content

Commit 1db1d3e

Browse files
authored
IGNITE-15803 Remove marshaller from IgniteConfiguration (#11951)
1 parent 978897e commit 1db1d3e

File tree

76 files changed

+130
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+130
-443
lines changed

modules/clients/src/test/config/jdbc-bin-config.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131

3232
<property name="localHost" value="127.0.0.1"/>
3333

34-
<property name="marshaller">
35-
<bean class="org.apache.ignite.internal.binary.BinaryMarshaller" />
36-
</property>
37-
3834
<property name="discoverySpi">
3935
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
4036
<property name="ipFinder">

modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import org.apache.ignite.lang.IgnitePredicate;
5858
import org.apache.ignite.lifecycle.LifecycleBean;
5959
import org.apache.ignite.lifecycle.LifecycleEventType;
60-
import org.apache.ignite.marshaller.Marshaller;
6160
import org.apache.ignite.plugin.PluginConfiguration;
6261
import org.apache.ignite.plugin.PluginProvider;
6362
import org.apache.ignite.plugin.segmentation.SegmentationPolicy;
@@ -332,9 +331,6 @@ public class IgniteConfiguration {
332331
/** Local node ID. */
333332
private UUID nodeId;
334333

335-
/** Marshaller. */
336-
private Marshaller marsh;
337-
338334
/** Marshal local jobs. */
339335
private boolean marshLocJobs = DFLT_MARSHAL_LOCAL_JOBS;
340336

@@ -682,7 +678,6 @@ public IgniteConfiguration(IgniteConfiguration cfg) {
682678
locHost = cfg.getLocalHost();
683679
log = cfg.getGridLogger();
684680
lsnrs = cfg.getLocalEventListeners();
685-
marsh = cfg.getMarshaller();
686681
marshLocJobs = cfg.isMarshalLocalJobs();
687682
mbeanSrv = cfg.getMBeanServer();
688683
metricsExpTime = cfg.getMetricsExpireTime();
@@ -1392,36 +1387,6 @@ public IgniteConfiguration setNodeId(UUID nodeId) {
13921387
return this;
13931388
}
13941389

1395-
/**
1396-
* Should return an instance of marshaller to use in grid. If not provided,
1397-
* default marshaller implementation that allows to read object field values
1398-
* without deserialization will be used.
1399-
*
1400-
* @return Marshaller to use in grid.
1401-
* @deprecated Since 2.1. Some Ignite features will not work if non-null marshaller is set
1402-
* (IgniteCache.withKeepBinary(), .NET, CPP, ODBC)
1403-
*/
1404-
@Deprecated
1405-
public Marshaller getMarshaller() {
1406-
return marsh;
1407-
}
1408-
1409-
/**
1410-
* Sets marshaller to use within grid.
1411-
*
1412-
* @param marsh Marshaller to use within grid.
1413-
* @see IgniteConfiguration#getMarshaller()
1414-
* @return {@code this} for chaining.
1415-
* @deprecated Since 2.1. Some Ignite features will not work if non-null marshaller is set
1416-
* (IgniteCache.withKeepBinary(), .NET, CPP, ODBC)
1417-
*/
1418-
@Deprecated
1419-
public IgniteConfiguration setMarshaller(Marshaller marsh) {
1420-
this.marsh = marsh;
1421-
1422-
return this;
1423-
}
1424-
14251390
/**
14261391
* Returns {@code true} if peer class loading is enabled, {@code false}
14271392
* otherwise. Default value is {@code false} specified by {@link #DFLT_P2P_ENABLED}.

modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ private void initFilter(IgnitePredicate<Event> filter, GridKernalContext ctx) th
238238
GridCacheAdapter cache = ctx.cache().internalCache(cacheName);
239239

240240
if (cache != null && cache.context().deploymentEnabled()) {
241-
wrapper.p2pMarshal(ctx.config().getMarshaller());
241+
wrapper.p2pMarshal(ctx.marshaller());
242242

243243
wrapper.cacheName = cacheName;
244244

@@ -387,7 +387,7 @@ private boolean filterDropsEvent(Event evt) {
387387
"with default class loader.");
388388
}
389389

390-
wrapper.p2pUnmarshal(ctx.config().getMarshaller(), U.resolveClassLoader(ldr, ctx.config()));
390+
wrapper.p2pUnmarshal(ctx.marshaller(), U.resolveClassLoader(ldr, ctx.config()));
391391
}
392392
catch (IgniteCheckedException e) {
393393
U.error(ctx.log(getClass()), "Failed to unmarshal event.", e);
@@ -419,7 +419,7 @@ private boolean filterDropsEvent(Event evt) {
419419

420420
depInfo = new GridDeploymentInfoBean(dep);
421421

422-
filterBytes = U.marshal(ctx.config().getMarshaller(), filter);
422+
filterBytes = U.marshal(ctx.marshaller(), filter);
423423
}
424424
}
425425

modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.concurrent.Executor;
2424
import org.apache.ignite.IgniteLogger;
2525
import org.apache.ignite.configuration.IgniteConfiguration;
26+
import org.apache.ignite.internal.binary.BinaryMarshaller;
2627
import org.apache.ignite.internal.cache.query.index.IndexProcessor;
2728
import org.apache.ignite.internal.cache.transform.CacheObjectTransformerProcessor;
2829
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager;
@@ -645,4 +646,9 @@ public interface GridKernalContext extends Iterable<GridComponent> {
645646
* @return Executor that is in charge of processing user async continuations.
646647
*/
647648
public Executor getAsyncContinuationExecutor();
649+
650+
/**
651+
* @return Marshaller instance.
652+
*/
653+
public BinaryMarshaller marshaller();
648654
}

modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.apache.ignite.cluster.ClusterNode;
3939
import org.apache.ignite.configuration.IgniteConfiguration;
4040
import org.apache.ignite.failure.FailureType;
41+
import org.apache.ignite.internal.binary.BinaryMarshaller;
4142
import org.apache.ignite.internal.cache.query.index.IndexProcessor;
4243
import org.apache.ignite.internal.cache.transform.CacheObjectTransformerProcessor;
4344
import org.apache.ignite.internal.maintenance.MaintenanceProcessor;
@@ -395,6 +396,9 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
395396
/** Recovery mode flag. Flag is set to {@code false} when discovery manager started. */
396397
private boolean recoveryMode = true;
397398

399+
/** Marshaller. */
400+
private final BinaryMarshaller marsh = new BinaryMarshaller();
401+
398402
/**
399403
* No-arg constructor is required by externalization.
400404
*/
@@ -1102,4 +1106,9 @@ public void recoveryMode(boolean recoveryMode) {
11021106
? ForkJoinPool.commonPool()
11031107
: config().getAsyncContinuationExecutor();
11041108
}
1109+
1110+
/** {@inheritDoc} */
1111+
@Override public BinaryMarshaller marshaller() {
1112+
return marsh;
1113+
}
11051114
}

modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ public GridMessageListenHandler(@Nullable Object topic, IgniteBiPredicate<UUID,
153153
assert ctx.config().isPeerClassLoadingEnabled();
154154

155155
if (topic != null)
156-
topicBytes = U.marshal(ctx.config().getMarshaller(), topic);
156+
topicBytes = U.marshal(ctx.marshaller(), topic);
157157

158-
predBytes = U.marshal(ctx.config().getMarshaller(), pred);
158+
predBytes = U.marshal(ctx.marshaller(), pred);
159159

160160
// Deploy only listener, as it is very likely to be of some user class.
161161
GridPeerDeployAware pda = U.peerDeployAware(pred);

modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,21 +1486,17 @@ private void checkPhysicalRam() {
14861486

14871487
/** */
14881488
private void initializeMarshaller() {
1489-
Marshaller marsh = ctx.config().getMarshaller();
1489+
if (!BinaryMarshaller.available()) {
1490+
String msg = "Standard BinaryMarshaller can't be used on this JVM. " +
1491+
"Switch to HotSpot JVM or reach out Apache Ignite community for recommendations.";
14901492

1491-
if (marsh == null) {
1492-
if (!BinaryMarshaller.available()) {
1493-
U.warn(log, "Standard BinaryMarshaller can't be used on this JVM. " +
1494-
"Switch to HotSpot JVM or reach out Apache Ignite community for recommendations.");
1493+
U.warn(log, msg);
14951494

1496-
marsh = ctx.marshallerContext().jdkMarshaller();
1497-
}
1498-
else
1499-
marsh = new BinaryMarshaller();
1500-
1501-
ctx.config().setMarshaller(marsh);
1495+
throw new IgniteException(msg);
15021496
}
15031497

1498+
Marshaller marsh = ctx.marshaller();
1499+
15041500
marsh.setContext(ctx.marshallerContext());
15051501

15061502
MarshallerUtils.setNodeName(marsh, ctx.igniteInstanceName());
@@ -1523,9 +1519,6 @@ private void suggestOptimizations(IgniteConfiguration cfg) {
15231519

15241520
if (cfg.getIncludeEventTypes() != null && cfg.getIncludeEventTypes().length != 0)
15251521
perf.add("Disable grid events (remove 'includeEventTypes' from configuration)");
1526-
1527-
if (BinaryMarshaller.available() && (cfg.getMarshaller() != null && !(cfg.getMarshaller() instanceof BinaryMarshaller)))
1528-
perf.add("Use default binary marshaller (do not set 'marshaller' explicitly)");
15291522
}
15301523

15311524
/**
@@ -1614,20 +1607,18 @@ private void fillNodeAttributes(boolean notifyEnabled) throws IgniteCheckedExcep
16141607
add(ATTR_JIT_NAME, U.getCompilerMx() == null ? "" : U.getCompilerMx().getName());
16151608
add(ATTR_BUILD_VER, VER_STR);
16161609
add(ATTR_BUILD_DATE, BUILD_TSTAMP_STR);
1617-
add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
1610+
add(ATTR_MARSHALLER, ctx.marshaller().getClass().getName());
16181611
add(ATTR_MARSHALLER_USE_DFLT_SUID,
16191612
getBoolean(IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID, OptimizedMarshaller.USE_DFLT_SUID));
16201613
add(ATTR_LATE_AFFINITY_ASSIGNMENT, cfg.isLateAffinityAssignment());
16211614

1622-
if (cfg.getMarshaller() instanceof BinaryMarshaller) {
1623-
add(ATTR_MARSHALLER_COMPACT_FOOTER, cfg.getBinaryConfiguration() == null ?
1624-
BinaryConfiguration.DFLT_COMPACT_FOOTER :
1625-
cfg.getBinaryConfiguration().isCompactFooter());
1615+
add(ATTR_MARSHALLER_COMPACT_FOOTER, cfg.getBinaryConfiguration() == null ?
1616+
BinaryConfiguration.DFLT_COMPACT_FOOTER :
1617+
cfg.getBinaryConfiguration().isCompactFooter());
16261618

1627-
add(ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2,
1628-
getBoolean(IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2,
1629-
BinaryUtils.USE_STR_SERIALIZATION_VER_2));
1630-
}
1619+
add(ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2,
1620+
getBoolean(IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2,
1621+
BinaryUtils.USE_STR_SERIALIZATION_VER_2));
16311622

16321623
add(ATTR_USER_NAME, System.getProperty("user.name"));
16331624
add(ATTR_IGNITE_INSTANCE_NAME, igniteInstanceName);
@@ -2036,7 +2027,7 @@ private Iterable<Object> lifecycleAwares(IgniteConfiguration cfg) {
20362027
objs.add(cfg.getConnectorConfiguration().getSslFactory());
20372028
}
20382029

2039-
objs.add(cfg.getMarshaller());
2030+
objs.add(ctx.marshaller());
20402031
objs.add(cfg.getGridLogger());
20412032
objs.add(cfg.getMBeanServer());
20422033

modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public IndexProcessor(GridKernalContext ctx) throws IgniteCheckedException {
136136
else
137137
idxRebuild = new IndexesRebuildTask();
138138

139-
serializer = new JavaObjectKeySerializer(ctx.config());
139+
serializer = new JavaObjectKeySerializer(U.resolveClassLoader(ctx.config()), ctx.marshaller());
140140
}
141141

142142
/**

modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/JavaObjectKeySerializer.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.ignite.internal.cache.query.index.sorted.inline;
1919

2020
import org.apache.ignite.IgniteCheckedException;
21-
import org.apache.ignite.configuration.IgniteConfiguration;
2221
import org.apache.ignite.internal.util.typedef.internal.U;
2322
import org.apache.ignite.marshaller.Marshaller;
2423

@@ -32,15 +31,6 @@ public class JavaObjectKeySerializer {
3231
/** Marshaller. */
3332
private final Marshaller marshaller;
3433

35-
/**
36-
* Constructor.
37-
*
38-
* @param cfg Ignite configuration.
39-
*/
40-
public JavaObjectKeySerializer(IgniteConfiguration cfg) {
41-
this(U.resolveClassLoader(cfg), cfg.getMarshaller());
42-
}
43-
4434
/**
4535
* Constructor.
4636
*

modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public class GridCheckpointManager extends GridManagerAdapter<CheckpointSpi> {
8181
public GridCheckpointManager(GridKernalContext ctx) {
8282
super(ctx, ctx.config().getCheckpointSpi());
8383

84-
marsh = ctx.config().getMarshaller();
84+
marsh = ctx.marshaller();
8585

8686
if (enabled()) {
8787
keyMap = new ConcurrentHashMap<>();

0 commit comments

Comments
 (0)