You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2015/02/02 04:28:41 UTC
[49/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
index 0000000,d22003b..c0e6a87
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
@@@ -1,0 -1,151 +1,149 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.compute.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Job siblings response.
+ */
+ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ @GridDirectTransient
+ private Collection<ComputeJobSibling> siblings;
+
+ /** */
+ private byte[] siblingsBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridJobSiblingsResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param siblings Siblings.
+ * @param siblingsBytes Serialized siblings.
+ */
+ public GridJobSiblingsResponse(@Nullable Collection<ComputeJobSibling> siblings, @Nullable byte[] siblingsBytes) {
+ this.siblings = siblings;
+ this.siblingsBytes = siblingsBytes;
+ }
+
+ /**
+ * @return Job siblings.
+ */
+ public Collection<ComputeJobSibling> jobSiblings() {
+ return siblings;
+ }
+
+ /**
+ * @param marsh Marshaller.
+ * @throws IgniteCheckedException In case of error.
+ */
+ public void unmarshalSiblings(IgniteMarshaller marsh) throws IgniteCheckedException {
+ assert marsh != null;
+
+ if (siblingsBytes != null)
+ siblings = marsh.unmarshal(siblingsBytes, null);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridJobSiblingsResponse _clone = new GridJobSiblingsResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridJobSiblingsResponse _clone = (GridJobSiblingsResponse)_msg;
+
+ _clone.siblings = siblings;
+ _clone.siblingsBytes = siblingsBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(siblingsBytes))
++ if (!commState.putByteArray("siblingsBytes", siblingsBytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] siblingsBytes0 = commState.getByteArray();
++ siblingsBytes = commState.getByteArray("siblingsBytes");
+
- if (siblingsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- siblingsBytes = siblingsBytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 4;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridJobSiblingsResponse.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index 0000000,17f3ec8..0b08ec6
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
@@@ -1,0 -1,515 +1,503 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.fs.*;
+ import org.apache.ignite.internal.processors.portable.*;
+ import org.apache.ignite.plugin.*;
+ import org.apache.ignite.internal.product.*;
+ import org.apache.ignite.internal.managers.security.*;
+ import org.apache.ignite.internal.managers.checkpoint.*;
+ import org.apache.ignite.internal.managers.collision.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.managers.discovery.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
+ import org.apache.ignite.internal.managers.failover.*;
+ import org.apache.ignite.internal.managers.indexing.*;
+ import org.apache.ignite.internal.managers.loadbalancer.*;
+ import org.apache.ignite.internal.managers.securesession.*;
+ import org.apache.ignite.internal.managers.swapspace.*;
+ import org.apache.ignite.internal.processors.affinity.*;
+ import org.apache.ignite.internal.processors.clock.*;
+ import org.apache.ignite.internal.processors.closure.*;
+ import org.apache.ignite.internal.processors.continuous.*;
+ import org.apache.ignite.internal.processors.dataload.*;
+ import org.apache.ignite.internal.processors.email.*;
+ import org.apache.ignite.internal.processors.hadoop.*;
+ import org.apache.ignite.internal.processors.interop.*;
+ import org.apache.ignite.internal.processors.job.*;
+ import org.apache.ignite.internal.processors.jobmetrics.*;
+ import org.apache.ignite.internal.processors.license.*;
+ import org.apache.ignite.internal.processors.offheap.*;
+ import org.apache.ignite.internal.processors.plugin.*;
+ import org.apache.ignite.internal.processors.port.*;
+ import org.apache.ignite.internal.processors.query.*;
+ import org.apache.ignite.internal.processors.resource.*;
+ import org.apache.ignite.internal.processors.rest.*;
+ import org.apache.ignite.internal.processors.schedule.*;
+ import org.apache.ignite.internal.processors.segmentation.*;
+ import org.apache.ignite.internal.processors.service.*;
+ import org.apache.ignite.internal.processors.session.*;
+ import org.apache.ignite.internal.processors.streamer.*;
+ import org.apache.ignite.internal.processors.task.*;
+ import org.apache.ignite.internal.processors.timeout.*;
-import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+
+ import java.util.*;
+ import java.util.concurrent.*;
+
+ /**
+ *
+ */
+ @GridToStringExclude
+ public interface GridKernalContext extends Iterable<GridComponent> {
+ /**
+ * Gets list of all grid components in the order they were added.
+ *
+ * @return List of all grid components in the order they were added.
+ */
+ public List<GridComponent> components();
+
+ /**
+ * Gets local node ID.
+ *
+ * @return Local node ID.
+ */
+ public UUID localNodeId();
+
+ /**
+ * Gets grid name.
+ *
+ * @return Grid name.
+ */
+ public String gridName();
+
+ /**
+ * Gets grid product.
+ *
+ * @return Grid product.
+ */
+ public IgniteProduct product();
+
+ /**
+ * Gets list of compatible versions.
+ *
+ * @return Compatible versions.
+ */
+ public Collection<String> compatibleVersions();
+
+ /**
+ * Gets logger.
+ *
+ * @return Logger.
+ */
+ public IgniteLogger log();
+
+ /**
+ * Gets logger for given class.
+ *
+ * @param cls Class to get logger for.
+ * @return Logger.
+ */
+ public IgniteLogger log(Class<?> cls);
+
+ /**
+ * @return {@code True} if grid is in the process of stopping.
+ */
+ public boolean isStopping();
+
+ /**
+ * Gets kernal gateway.
+ *
+ * @return Kernal gateway.
+ */
+ public GridKernalGateway gateway();
+
+ /**
+ * Gets grid instance managed by kernal.
+ *
+ * @return Grid instance.
+ */
+ public IgniteEx grid();
+
+ /**
+ * Gets grid configuration.
+ *
+ * @return Grid configuration.
+ */
+ public IgniteConfiguration config();
+
+ /**
+ * Gets task processor.
+ *
+ * @return Task processor.
+ */
+ public GridTaskProcessor task();
+
+ /**
+ * Gets license processor.
+ *
+ * @return License processor.
+ */
+ public GridLicenseProcessor license();
+
+ /**
+ * Gets cache data affinity processor.
+ *
+ * @return Cache data affinity processor.
+ */
+ public GridAffinityProcessor affinity();
+
+ /**
+ * Gets job processor.
+ *
+ * @return Job processor
+ */
+ public GridJobProcessor job();
+
+ /**
+ * Gets offheap processor.
+ *
+ * @return Off-heap processor.
+ */
+ public GridOffHeapProcessor offheap();
+
+ /**
+ * Gets timeout processor.
+ *
+ * @return Timeout processor.
+ */
+ public GridTimeoutProcessor timeout();
+
+ /**
+ * Gets time processor.
+ *
+ * @return Time processor.
+ */
+ public GridClockSyncProcessor clockSync();
+
+ /**
+ * Gets resource processor.
+ *
+ * @return Resource processor.
+ */
+ public GridResourceProcessor resource();
+
+ /**
+ * Gets job metric processor.
+ *
+ * @return Metrics processor.
+ */
+ public GridJobMetricsProcessor jobMetric();
+
+ /**
+ * Gets caches processor.
+ *
+ * @return Cache processor.
+ */
+ public GridCacheProcessor cache();
+
+ /**
+ * Gets task session processor.
+ *
+ * @return Session processor.
+ */
+ public GridTaskSessionProcessor session();
+
+ /**
+ * Gets closure processor.
+ *
+ * @return Closure processor.
+ */
+ public GridClosureProcessor closure();
+
+ /**
+ * Gets service processor.
+ *
+ * @return Service processor.
+ */
+ public GridServiceProcessor service();
+
+ /**
+ * Gets port processor.
+ *
+ * @return Port processor.
+ */
+ public GridPortProcessor ports();
+
+ /**
+ * Gets email processor.
+ *
+ * @return Email processor.
+ */
+ public IgniteEmailProcessorAdapter email();
+
+ /**
+ * Gets schedule processor.
+ *
+ * @return Schedule processor.
+ */
+ public IgniteScheduleProcessorAdapter schedule();
+
+ /**
+ * Gets REST processor.
+ *
+ * @return REST processor.
+ */
+ public GridRestProcessor rest();
+
+ /**
+ * Gets segmentation processor.
+ *
+ * @return Segmentation processor.
+ */
+ public GridSegmentationProcessor segmentation();
+
+ /**
+ * Gets data loader processor.
+ *
+ * @return Data loader processor.
+ */
+ public <K, V> GridDataLoaderProcessor<K, V> dataLoad();
+
+ /**
+ * Gets file system processor.
+ *
+ * @return File system processor.
+ */
+ public IgniteFsProcessorAdapter ggfs();
+
+ /**
+ * Gets GGFS utils processor.
+ *
+ * @return GGFS utils processor.
+ */
+ public IgniteFsHelper ggfsHelper();
+
+ /**
+ * Gets stream processor.
+ *
+ * @return Stream processor.
+ */
+ public GridStreamProcessor stream();
+
+ /**
+ * Gets event continuous processor.
+ *
+ * @return Event continuous processor.
+ */
+ public GridContinuousProcessor continuous();
+
+ /**
+ * Gets Hadoop processor.
+ *
+ * @return Hadoop processor.
+ */
+ public IgniteHadoopProcessorAdapter hadoop();
+
+ /**
+ * Gets utility cache pool.
+ *
+ * @return DR pool.
+ */
+ public ExecutorService utilityCachePool();
+
+ /**
+ * Gets portable processor.
+ *
+ * @return Portable processor.
+ */
+ public GridPortableProcessor portable();
+
+ /**
+ * Gets interop processor.
+ *
+ * @return Interop processor.
+ */
+ public GridInteropProcessor interop();
+
+ /**
+ * Gets query processor.
+ *
+ * @return Query processor.
+ */
+ public GridQueryProcessor query();
+
+ /**
+ * @return Plugin processor.
+ */
+ public IgnitePluginProcessor plugins();
+
+ /**
+ * Gets deployment manager.
+ *
+ * @return Deployment manager.
+ */
+ public GridDeploymentManager deploy();
+
+ /**
+ * Gets communication manager.
+ *
+ * @return Communication manager.
+ */
+ public GridIoManager io();
+
+ /**
+ * Gets discovery manager.
+ *
+ * @return Discovery manager.
+ */
+ public GridDiscoveryManager discovery();
+
+ /**
+ * Gets checkpoint manager.
+ *
+ * @return Checkpoint manager.
+ */
+ public GridCheckpointManager checkpoint();
+
+ /**
+ * Gets event storage manager.
+ *
+ * @return Event storage manager.
+ */
+ public GridEventStorageManager event();
+
+ /**
+ * Gets failover manager.
+ *
+ * @return Failover manager.
+ */
+ public GridFailoverManager failover();
+
+ /**
+ * Gets collision manager.
+ *
+ * @return Collision manager.
+ */
+ public GridCollisionManager collision();
+
+ /**
+ * Gets authentication manager.
+ *
+ * @return Authentication manager.
+ */
+ public GridSecurityManager security();
+
+ /**
+ * Gets secure session manager.
+ *
+ * @return Secure session manager.
+ */
+ public GridSecureSessionManager secureSession();
+
+ /**
+ * Gets load balancing manager.
+ *
+ * @return Load balancing manager.
+ */
+ public GridLoadBalancerManager loadBalancing();
+
+ /**
+ * Gets swap space manager.
+ *
+ * @return Swap space manager.
+ */
+ public GridSwapSpaceManager swap();
+
+ /**
+ * Gets indexing manager.
+ *
+ * @return Indexing manager.
+ */
+ public GridIndexingManager indexing();
+
+ /**
+ * Gets grid time source.
+ *
+ * @return Time source.
+ */
+ public GridClockSource timeSource();
+
+ /**
+ * Sets segmented flag to {@code true} when node is stopped due to segmentation issues.
+ */
+ public void markSegmented();
+
+ /**
+ * Gets segmented flag.
+ *
+ * @return {@code True} if network is currently segmented, {@code false} otherwise.
+ */
+ public boolean segmented();
+
+ /**
+ * Print grid kernal memory stats (sizes of internal structures, etc.).
+ *
+ * NOTE: This method is for testing and profiling purposes only.
+ */
+ public void printMemoryStats();
+
+ /**
+ * Checks whether this node is daemon.
+ *
+ * @return {@code True} if this node is daemon, {@code false} otherwise.
+ */
+ public boolean isDaemon();
+
+ /**
+ * @return Performance suggestions object.
+ */
+ public GridPerformanceSuggestions performance();
+
+ /**
+ * @return Enterprise release flag.
+ */
+ public boolean isEnterprise();
+
+ /**
+ * Gets user version for given class loader by checking
+ * {@code META-INF/gridgain.xml} file for {@code userVersion} attribute. If
+ * {@code gridgain.xml} file is not found, or user version is not specified there,
+ * then default version (empty string) is returned.
+ *
+ * @param ldr Class loader.
+ * @return User version for given class loader or empty string if no version
+ * was explicitly specified.
+ */
+ public String userVersion(ClassLoader ldr);
+
+ /**
+ * @param name Plugin name.
+ * @return Plugin provider instance.
+ * @throws PluginNotFoundException If plugin provider for the given name was not found.
+ */
+ public PluginProvider pluginProvider(String name) throws PluginNotFoundException;
+
+ /**
+ * Creates optional component.
+ *
+ * @param cls Component class.
+ * @return Created component.
+ */
+ public <T> T createComponent(Class<T> cls);
-
- /**
- * @return Message factory.
- */
- public GridTcpMessageFactory messageFactory();
-
- /**
- * @param producer Message producer.
- * @return Message type code.
- */
- public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer);
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 0000000,88dbef6..c39a4f6
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@@ -1,0 -1,905 +1,836 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.fs.*;
+ import org.apache.ignite.internal.processors.portable.*;
+ import org.apache.ignite.internal.processors.streamer.*;
+ import org.apache.ignite.plugin.*;
+ import org.apache.ignite.internal.product.*;
+ import org.apache.ignite.internal.managers.checkpoint.*;
+ import org.apache.ignite.internal.managers.collision.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.managers.discovery.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
+ import org.apache.ignite.internal.managers.failover.*;
+ import org.apache.ignite.internal.managers.indexing.*;
+ import org.apache.ignite.internal.managers.loadbalancer.*;
+ import org.apache.ignite.internal.managers.securesession.*;
+ import org.apache.ignite.internal.managers.security.*;
+ import org.apache.ignite.internal.managers.swapspace.*;
+ import org.apache.ignite.internal.processors.affinity.*;
+ import org.apache.ignite.internal.processors.cache.dr.*;
+ import org.apache.ignite.internal.processors.cache.dr.os.*;
+ import org.apache.ignite.internal.processors.clock.*;
+ import org.apache.ignite.internal.processors.closure.*;
+ import org.apache.ignite.internal.processors.continuous.*;
+ import org.apache.ignite.internal.processors.dataload.*;
+ import org.apache.ignite.internal.processors.email.*;
+ import org.apache.ignite.internal.processors.hadoop.*;
+ import org.apache.ignite.internal.processors.interop.*;
+ import org.apache.ignite.internal.processors.job.*;
+ import org.apache.ignite.internal.processors.jobmetrics.*;
+ import org.apache.ignite.internal.processors.license.*;
+ import org.apache.ignite.internal.processors.offheap.*;
+ import org.apache.ignite.internal.processors.plugin.*;
+ import org.apache.ignite.internal.processors.port.*;
+ import org.apache.ignite.internal.processors.query.*;
+ import org.apache.ignite.internal.processors.resource.*;
+ import org.apache.ignite.internal.processors.rest.*;
+ import org.apache.ignite.internal.processors.schedule.*;
+ import org.apache.ignite.internal.processors.segmentation.*;
+ import org.apache.ignite.internal.processors.service.*;
+ import org.apache.ignite.internal.processors.session.*;
+ import org.apache.ignite.internal.processors.spring.*;
+ import org.apache.ignite.internal.processors.task.*;
+ import org.apache.ignite.internal.processors.timeout.*;
-import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+
+ import static org.apache.ignite.IgniteSystemProperties.*;
+ import static org.apache.ignite.internal.IgniteComponentType.*;
+
+ /**
+ * Implementation of kernal context.
+ */
+ @GridToStringExclude
+ public class GridKernalContextImpl implements GridKernalContext, Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private static final ThreadLocal<String> stash = new ThreadLocal<>();
+
+ /*
+ * Managers.
+ * ========
+ */
+
+ /** */
+ @GridToStringExclude
+ private GridDeploymentManager depMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridIoManager ioMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridDiscoveryManager discoMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridCheckpointManager cpMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridEventStorageManager evtMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridFailoverManager failoverMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridCollisionManager colMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridLoadBalancerManager loadMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridSecurityManager authMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridSecureSessionManager sesMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridSwapSpaceManager swapspaceMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridIndexingManager indexingMgr;
+
+ /*
+ * Processors.
+ * ==========
+ */
+
+ /** */
+ @GridToStringInclude
+ private GridQueryProcessor qryProc;
+
+ /** */
+ @GridToStringInclude
+ private GridTaskProcessor taskProc;
+
+ /** */
+ @GridToStringInclude
+ private GridJobProcessor jobProc;
+
+ /** */
+ @GridToStringInclude
+ private GridTimeoutProcessor timeProc;
+
+ /** */
+ @GridToStringInclude
+ private GridClockSyncProcessor clockSyncProc;
+
+ /** */
+ @GridToStringInclude
+ private GridResourceProcessor rsrcProc;
+
+ /** */
+ @GridToStringInclude
+ private GridJobMetricsProcessor metricsProc;
+
+ /** */
+ @GridToStringInclude
+ private GridClosureProcessor closProc;
+
+ /** */
+ @GridToStringInclude
+ private GridServiceProcessor svcProc;
+
+ /** */
+ @GridToStringInclude
+ private GridCacheProcessor cacheProc;
+
+ /** */
+ @GridToStringInclude
+ private GridTaskSessionProcessor sesProc;
+
+ /** */
+ @GridToStringInclude
+ private GridPortProcessor portProc;
+
+ /** */
+ @GridToStringInclude
+ private GridOffHeapProcessor offheapProc;
+
+ /** */
+ @GridToStringInclude
+ private IgniteEmailProcessorAdapter emailProc;
+
+ /** */
+ @GridToStringInclude
+ private IgniteScheduleProcessorAdapter scheduleProc;
+
+ /** */
+ @GridToStringInclude
+ private GridRestProcessor restProc;
+
+ /** */
+ @GridToStringInclude
+ private GridDataLoaderProcessor dataLdrProc;
+
+ /** */
+ @GridToStringInclude
+ private IgniteFsProcessorAdapter ggfsProc;
+
+ /** */
+ @GridToStringInclude
+ private IgniteFsHelper ggfsHelper;
+
+ /** */
+ @GridToStringInclude
+ private GridSegmentationProcessor segProc;
+
+ /** */
+ @GridToStringInclude
+ private GridAffinityProcessor affProc;
+
+ /** */
+ @GridToStringInclude
+ private GridLicenseProcessor licProc;
+
+ /** */
+ @GridToStringInclude
+ private GridStreamProcessor streamProc;
+
+ /** */
+ @GridToStringExclude
+ private GridContinuousProcessor contProc;
+
+ /** */
+ @GridToStringExclude
+ private IgniteHadoopProcessorAdapter hadoopProc;
+
+ /** */
+ @GridToStringExclude
+ private IgnitePluginProcessor pluginProc;
+
+ /** */
+ @GridToStringExclude
+ private GridPortableProcessor portableProc;
+
+ /** */
+ @GridToStringExclude
+ private GridInteropProcessor interopProc;
+
+ /** */
+ @GridToStringExclude
+ private IgniteSpringProcessor spring;
+
+ /** */
+ @GridToStringExclude
+ private List<GridComponent> comps = new LinkedList<>();
+
+ /** */
+ private IgniteEx grid;
+
+ /** */
+ private ExecutorService utilityCachePool;
+
+ /** */
+ private IgniteProduct product;
+
+ /** */
+ private IgniteConfiguration cfg;
+
+ /** */
+ private GridKernalGateway gw;
+
+ /** Network segmented flag. */
+ private volatile boolean segFlag;
+
+ /** Time source. */
+ private GridClockSource clockSrc = new GridJvmClockSource();
+
+ /** Performance suggestions. */
+ private final GridPerformanceSuggestions perf = new GridPerformanceSuggestions();
+
+ /** Enterprise release flag. */
+ private boolean ent;
+
- /** */
- private GridTcpMessageFactory msgFactory;
-
- /** */
- private int pluginMsg = GridTcpCommunicationMessageFactory.MAX_COMMON_TYPE;
-
- /** */
- private Map<Byte, GridTcpCommunicationMessageProducer> pluginMsgs;
-
+ /**
+ * No-arg constructor is required by externalization.
+ */
+ public GridKernalContextImpl() {
+ // No-op.
+ }
+
+ /**
+ * Creates new kernal context.
+ *
+ * @param log Logger.
+ * @param grid Grid instance managed by kernal.
+ * @param cfg Grid configuration.
+ * @param gw Kernal gateway.
+ * @param utilityCachePool Utility cache pool.
+ * @param ent Release enterprise flag.
+ */
+ @SuppressWarnings("TypeMayBeWeakened")
+ protected GridKernalContextImpl(GridLoggerProxy log,
+ IgniteEx grid,
+ IgniteConfiguration cfg,
+ GridKernalGateway gw,
+ ExecutorService utilityCachePool,
+ boolean ent) {
+ assert grid != null;
+ assert cfg != null;
+ assert gw != null;
+
+ this.grid = grid;
+ this.cfg = cfg;
+ this.gw = gw;
+ this.ent = ent;
+ this.utilityCachePool = utilityCachePool;
+
+ try {
+ spring = SPRING.create(false);
+ }
+ catch (IgniteCheckedException ignored) {
+ if (log != null && log.isDebugEnabled())
+ log.debug("Failed to load spring component, will not be able to extract userVersion from " +
+ "META-INF/gridgain.xml.");
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public Iterator<GridComponent> iterator() {
+ return comps.iterator();
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<GridComponent> components() {
+ return Collections.unmodifiableList(comps);
+ }
+
+ /**
+ * @param comp Manager to add.
+ */
+ public void add(GridComponent comp) {
+ assert comp != null;
+
+ /*
+ * Managers.
+ * ========
+ */
+
+ if (comp instanceof GridDeploymentManager)
+ depMgr = (GridDeploymentManager)comp;
+ else if (comp instanceof GridIoManager)
+ ioMgr = (GridIoManager)comp;
+ else if (comp instanceof GridDiscoveryManager)
+ discoMgr = (GridDiscoveryManager)comp;
+ else if (comp instanceof GridCheckpointManager)
+ cpMgr = (GridCheckpointManager)comp;
+ else if (comp instanceof GridEventStorageManager)
+ evtMgr = (GridEventStorageManager)comp;
+ else if (comp instanceof GridFailoverManager)
+ failoverMgr = (GridFailoverManager)comp;
+ else if (comp instanceof GridCollisionManager)
+ colMgr = (GridCollisionManager)comp;
+ else if (comp instanceof GridSecurityManager)
+ authMgr = (GridSecurityManager)comp;
+ else if (comp instanceof GridSecureSessionManager)
+ sesMgr = (GridSecureSessionManager)comp;
+ else if (comp instanceof GridLoadBalancerManager)
+ loadMgr = (GridLoadBalancerManager)comp;
+ else if (comp instanceof GridSwapSpaceManager)
+ swapspaceMgr = (GridSwapSpaceManager)comp;
+ else if (comp instanceof GridIndexingManager)
+ indexingMgr = (GridIndexingManager)comp;
+
+ /*
+ * Processors.
+ * ==========
+ */
+
+ else if (comp instanceof GridTaskProcessor)
+ taskProc = (GridTaskProcessor)comp;
+ else if (comp instanceof GridJobProcessor)
+ jobProc = (GridJobProcessor)comp;
+ else if (comp instanceof GridTimeoutProcessor)
+ timeProc = (GridTimeoutProcessor)comp;
+ else if (comp instanceof GridClockSyncProcessor)
+ clockSyncProc = (GridClockSyncProcessor)comp;
+ else if (comp instanceof GridResourceProcessor)
+ rsrcProc = (GridResourceProcessor)comp;
+ else if (comp instanceof GridJobMetricsProcessor)
+ metricsProc = (GridJobMetricsProcessor)comp;
+ else if (comp instanceof GridCacheProcessor)
+ cacheProc = (GridCacheProcessor)comp;
+ else if (comp instanceof GridTaskSessionProcessor)
+ sesProc = (GridTaskSessionProcessor)comp;
+ else if (comp instanceof GridPortProcessor)
+ portProc = (GridPortProcessor)comp;
+ else if (comp instanceof IgniteEmailProcessorAdapter)
+ emailProc = (IgniteEmailProcessorAdapter)comp;
+ else if (comp instanceof GridClosureProcessor)
+ closProc = (GridClosureProcessor)comp;
+ else if (comp instanceof GridServiceProcessor)
+ svcProc = (GridServiceProcessor)comp;
+ else if (comp instanceof IgniteScheduleProcessorAdapter)
+ scheduleProc = (IgniteScheduleProcessorAdapter)comp;
+ else if (comp instanceof GridSegmentationProcessor)
+ segProc = (GridSegmentationProcessor)comp;
+ else if (comp instanceof GridAffinityProcessor)
+ affProc = (GridAffinityProcessor)comp;
+ else if (comp instanceof GridRestProcessor)
+ restProc = (GridRestProcessor)comp;
+ else if (comp instanceof GridDataLoaderProcessor)
+ dataLdrProc = (GridDataLoaderProcessor)comp;
+ else if (comp instanceof IgniteFsProcessorAdapter)
+ ggfsProc = (IgniteFsProcessorAdapter)comp;
+ else if (comp instanceof GridOffHeapProcessor)
+ offheapProc = (GridOffHeapProcessor)comp;
+ else if (comp instanceof GridLicenseProcessor)
+ licProc = (GridLicenseProcessor)comp;
+ else if (comp instanceof GridStreamProcessor)
+ streamProc = (GridStreamProcessor)comp;
+ else if (comp instanceof GridContinuousProcessor)
+ contProc = (GridContinuousProcessor)comp;
+ else if (comp instanceof IgniteHadoopProcessorAdapter)
+ hadoopProc = (IgniteHadoopProcessorAdapter)comp;
+ else if (comp instanceof GridPortableProcessor)
+ portableProc = (GridPortableProcessor)comp;
+ else if (comp instanceof GridInteropProcessor)
+ interopProc = (GridInteropProcessor)comp;
+ else if (comp instanceof IgnitePluginProcessor)
+ pluginProc = (IgnitePluginProcessor)comp;
+ else if (comp instanceof GridQueryProcessor)
+ qryProc = (GridQueryProcessor)comp;
+ else
+ assert (comp instanceof GridPluginComponent) : "Unknown manager class: " + comp.getClass();
+
+ comps.add(comp);
+ }
+
+ /**
+ * @param helper Helper to add.
+ */
+ public void addHelper(Object helper) {
+ assert helper != null;
+
+ if (helper instanceof IgniteFsHelper)
+ ggfsHelper = (IgniteFsHelper)helper;
+ else
+ assert false : "Unknown helper class: " + helper.getClass();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> compatibleVersions() {
+ return grid.compatibleVersions();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isStopping() {
+ GridKernalState state = gw.getState();
+
+ return state == GridKernalState.STOPPING || state == GridKernalState.STOPPED;
+ }
+
+ /** {@inheritDoc} */
+ @Override public UUID localNodeId() {
+ return cfg.getNodeId();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String gridName() {
+ return cfg.getGridName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridKernalGateway gateway() {
+ return gw;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteEx grid() {
+ return grid;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteConfiguration config() {
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridTaskProcessor task() {
+ return taskProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridJobProcessor job() {
+ return jobProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridTimeoutProcessor timeout() {
+ return timeProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridClockSyncProcessor clockSync() {
+ return clockSyncProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridResourceProcessor resource() {
+ return rsrcProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridJobMetricsProcessor jobMetric() {
+ return metricsProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheProcessor cache() {
+ return cacheProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridTaskSessionProcessor session() {
+ return sesProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridClosureProcessor closure() {
+ return closProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridServiceProcessor service() {
+ return svcProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridPortProcessor ports() {
+ return portProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteEmailProcessorAdapter email() {
+ return emailProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridOffHeapProcessor offheap() {
+ return offheapProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteScheduleProcessorAdapter schedule() {
+ return scheduleProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStreamProcessor stream() {
+ return streamProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridDeploymentManager deploy() {
+ return depMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridIoManager io() {
+ return ioMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridDiscoveryManager discovery() {
+ return discoMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCheckpointManager checkpoint() {
+ return cpMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridEventStorageManager event() {
+ return evtMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridFailoverManager failover() {
+ return failoverMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCollisionManager collision() {
+ return colMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSecurityManager security() {
+ return authMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSecureSessionManager secureSession() {
+ return sesMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridLoadBalancerManager loadBalancing() {
+ return loadMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSwapSpaceManager swap() {
+ return swapspaceMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridIndexingManager indexing() {
+ return indexingMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridLicenseProcessor license() {
+ return licProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridAffinityProcessor affinity() {
+ return affProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridRestProcessor rest() {
+ return restProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSegmentationProcessor segmentation() {
+ return segProc;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public <K, V> GridDataLoaderProcessor<K, V> dataLoad() {
+ return (GridDataLoaderProcessor<K, V>)dataLdrProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFsProcessorAdapter ggfs() {
+ return ggfsProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFsHelper ggfsHelper() {
+ return ggfsHelper;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridContinuousProcessor continuous() {
+ return contProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteHadoopProcessorAdapter hadoop() {
+ return hadoopProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ExecutorService utilityCachePool() {
+ return utilityCachePool;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridPortableProcessor portable() {
+ return portableProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridInteropProcessor interop() {
+ return interopProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridQueryProcessor query() {
+ return qryProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger log() {
+ return config().getGridLogger();
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger log(Class<?> cls) {
+ return config().getGridLogger().getLogger(cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void markSegmented() {
+ segFlag = true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean segmented() {
+ return segFlag;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridClockSource timeSource() {
+ return clockSrc;
+ }
+
+ /**
+ * @param product Product.
+ */
+ public void product(IgniteProduct product) {
+ this.product = product;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteProduct product() {
+ return product;
+ }
+
+ /**
+ * Sets time source. For test purposes only.
+ *
+ * @param clockSrc Time source.
+ */
+ public void timeSource(GridClockSource clockSrc) {
+ this.clockSrc = clockSrc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridPerformanceSuggestions performance() {
+ return perf;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isEnterprise() {
+ return ent;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void printMemoryStats() {
+ X.println(">>> ");
+ X.println(">>> Grid memory stats [grid=" + gridName() + ']');
+
+ for (GridComponent comp : comps)
+ comp.printMemoryStats();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isDaemon() {
+ return config().isDaemon() || "true".equalsIgnoreCase(System.getProperty(GG_DAEMON));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String userVersion(ClassLoader ldr) {
+ return spring != null ? spring.userVersion(ldr, log()) : U.DFLT_USER_VERSION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public PluginProvider pluginProvider(String name) throws PluginNotFoundException {
+ PluginProvider plugin = pluginProc.pluginProvider(name);
+
+ if (plugin == null)
+ throw new PluginNotFoundException(name);
+
+ return plugin;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public <T> T createComponent(Class<T> cls) {
+ T res = pluginProc.createComponent(cls);
+
+ if (res != null)
+ return res;
+
+ if (cls.equals(GridCacheDrManager.class))
+ return (T)new GridOsCacheDrManager();
+
+ throw new IgniteException("Unsupported component type: " + cls);
+ }
+
- /** {@inheritDoc} */
- @Override public GridTcpMessageFactory messageFactory() {
- assert msgFactory != null;
-
- return msgFactory;
- }
-
- /** {@inheritDoc} */
- @Override public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer) {
- int nextMsg = ++pluginMsg;
-
- if (nextMsg > Byte.MAX_VALUE)
- throw new IgniteException();
-
- if (pluginMsgs == null)
- pluginMsgs = new HashMap<>();
-
- pluginMsgs.put((byte)nextMsg, producer);
-
- return (byte)nextMsg;
- }
-
- /**
- * Creates message factory.
- */
- void createMessageFactory() {
- final GridTcpCommunicationMessageProducer[] common = GridTcpCommunicationMessageFactory.commonProducers();
-
- final GridTcpCommunicationMessageProducer[] producers;
-
- if (pluginMsgs != null) {
- producers = Arrays.copyOf(common, pluginMsg + 1);
-
- for (Map.Entry<Byte, GridTcpCommunicationMessageProducer> e : pluginMsgs.entrySet()) {
- assert producers[e.getKey()] == null : e.getKey();
-
- producers[e.getKey()] = e.getValue();
- }
-
- pluginMsgs = null;
- }
- else
- producers = common;
-
- msgFactory = new GridTcpMessageFactory() {
- @Override public GridTcpCommunicationMessageAdapter create(byte type) {
- if (type < 0 || type >= producers.length)
- return GridTcpCommunicationMessageFactory.create(type);
-
- GridTcpCommunicationMessageProducer producer = producers[type];
-
- if (producer != null)
- return producer.create(type);
- else
- throw new IllegalStateException("Common message type producer is not registered: " + type);
- }
- };
- }
-
+ /**
+ * @return Plugin manager.
+ */
+ @Override public IgnitePluginProcessor plugins() {
+ return pluginProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeString(out, grid.name());
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ stash.set(U.readString(in));
+ }
+
+ /**
+ * Reconstructs object on unmarshalling.
+ *
+ * @return Reconstructed object.
+ * @throws ObjectStreamException Thrown in case of unmarshalling error.
+ */
+ protected Object readResolve() throws ObjectStreamException {
+ try {
+ return IgnitionEx.gridx(stash.get()).context();
+ }
+ catch (IllegalStateException e) {
+ throw U.withCause(new InvalidObjectException(e.getMessage()), e);
+ }
+ finally {
+ stash.remove();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridKernalContextImpl.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
index 0000000,9346ae7..9e9ddbf
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
@@@ -1,0 -1,102 +1,102 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.plugin.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.internal.util.direct.*;
+
+ import java.util.*;
+
+ /**
+ *
+ */
+ public class GridPluginContext implements PluginContext {
+ /** */
+ private final PluginConfiguration cfg;
+
+ /** */
+ private final GridKernalContext ctx;
+
+ /** */
+ private IgniteConfiguration igniteCfg;
+
+ /**
+ * @param ctx Kernal context.
+ * @param cfg Plugin configuration.
+ */
+ public GridPluginContext(GridKernalContext ctx, PluginConfiguration cfg, IgniteConfiguration igniteCfg) {
+ this.cfg = cfg;
+ this.ctx = ctx;
+ this.igniteCfg = igniteCfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <C extends PluginConfiguration> C configuration() {
+ return (C)cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteConfiguration igniteConfiguration() {
+ return igniteCfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Ignite grid() {
+ return ctx.grid();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> nodes() {
+ return ctx.discovery().allNodes();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterNode localNode() {
+ return ctx.discovery().localNode();
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger log(Class<?> cls) {
+ return ctx.log(cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void registerPort(int port, IgnitePortProtocol proto, Class<?> cls) {
+ ctx.ports().registerPort(port, proto, cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void deregisterPort(int port, IgnitePortProtocol proto, Class<?> cls) {
+ ctx.ports().deregisterPort(port, proto, cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void deregisterPorts(Class<?> cls) {
+ ctx.ports().deregisterPorts(cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer) {
- return ctx.registerMessageProducer(producer);
++ return ctx.io().registerMessageProducer(producer);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
index 0000000,6bb0b4f..deb5567
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
@@@ -1,0 -1,134 +1,132 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Request for cancelling tasks.
+ */
+ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private IgniteUuid sesId;
+
+ /**
+ * No-op constructor to support {@link Externalizable} interface.
+ * This constructor is not meant to be used for other purposes.
+ */
+ public GridTaskCancelRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param sesId Task session ID.
+ */
+ public GridTaskCancelRequest(IgniteUuid sesId) {
+ assert sesId != null;
+
+ this.sesId = sesId;
+ }
+
+ /**
+ * Gets execution ID of task to be cancelled.
+ *
+ * @return Execution ID of task to be cancelled.
+ */
+ public IgniteUuid sessionId() {
+ return sesId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridTaskCancelRequest _clone = new GridTaskCancelRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridTaskCancelRequest _clone = (GridTaskCancelRequest)_msg;
+
+ _clone.sesId = sesId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 5;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridTaskCancelRequest.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
index 0000000,4061808..1343f45
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
@@@ -1,0 -1,206 +1,200 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Task session request.
+ */
+ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter implements GridTaskMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Task session ID. */
+ private IgniteUuid sesId;
+
+ /** ID of job within a task. */
+ private IgniteUuid jobId;
+
+ /** Changed attributes bytes. */
+ private byte[] attrsBytes;
+
+ /** Changed attributes. */
+ @GridDirectTransient
+ private Map<?, ?> attrs;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridTaskSessionRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param sesId Session ID.
+ * @param jobId Job ID.
+ * @param attrsBytes Serialized attributes.
+ * @param attrs Attributes.
+ */
+ public GridTaskSessionRequest(IgniteUuid sesId, IgniteUuid jobId, byte[] attrsBytes, Map<?, ?> attrs) {
+ assert sesId != null;
+ assert attrsBytes != null;
+ assert attrs != null;
+
+ this.sesId = sesId;
+ this.jobId = jobId;
+ this.attrsBytes = attrsBytes;
+ this.attrs = attrs;
+ }
+
+ /**
+ * @return Changed attributes (serialized).
+ */
+ public byte[] getAttributesBytes() {
+ return attrsBytes;
+ }
+
+ /**
+ * @return Changed attributes.
+ */
+ public Map<?, ?> getAttributes() {
+ return attrs;
+ }
+
+ /**
+ * @return Session ID.
+ */
+ @Override public IgniteUuid getSessionId() {
+ return sesId;
+ }
+
+ /**
+ * @return Job ID.
+ */
+ public IgniteUuid getJobId() {
+ return jobId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridTaskSessionRequest _clone = new GridTaskSessionRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridTaskSessionRequest _clone = (GridTaskSessionRequest)_msg;
+
+ _clone.sesId = sesId;
+ _clone.jobId = jobId;
+ _clone.attrsBytes = attrsBytes;
+ _clone.attrs = attrs;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(attrsBytes))
++ if (!commState.putByteArray("attrsBytes", attrsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(jobId))
++ if (!commState.putGridUuid("jobId", jobId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] attrsBytes0 = commState.getByteArray();
++ attrsBytes = commState.getByteArray("attrsBytes");
+
- if (attrsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- attrsBytes = attrsBytes0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid jobId0 = commState.getGridUuid();
++ jobId = commState.getGridUuid("jobId");
+
- if (jobId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- jobId = jobId0;
-
+ commState.idx++;
+
+ case 2:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 6;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridTaskSessionRequest.class, this);
+ }
+ }