Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@
import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexCreateOperationMarshallableSerializer;
import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexDropOperation;
import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexDropOperationSerializer;
import org.apache.ignite.internal.processors.service.ServiceChangeBatchRequest;
import org.apache.ignite.internal.processors.service.ServiceChangeBatchRequestSerializer;
import org.apache.ignite.internal.processors.service.ServiceClusterDeploymentResult;
import org.apache.ignite.internal.processors.service.ServiceClusterDeploymentResultBatch;
import org.apache.ignite.internal.processors.service.ServiceClusterDeploymentResultBatchSerializer;
import org.apache.ignite.internal.processors.service.ServiceClusterDeploymentResultSerializer;
import org.apache.ignite.internal.processors.service.ServiceDeploymentProcessId;
import org.apache.ignite.internal.processors.service.ServiceDeploymentProcessIdSerializer;
import org.apache.ignite.internal.processors.service.ServiceDeploymentRequest;
import org.apache.ignite.internal.processors.service.ServiceDeploymentRequestMarshallableSerializer;
import org.apache.ignite.internal.processors.service.ServiceSingleNodeDeploymentResult;
import org.apache.ignite.internal.processors.service.ServiceSingleNodeDeploymentResultSerializer;
import org.apache.ignite.internal.processors.service.ServiceUndeploymentRequest;
import org.apache.ignite.internal.processors.service.ServiceUndeploymentRequestSerializer;
import org.apache.ignite.internal.util.distributed.FullMessage;
import org.apache.ignite.internal.util.distributed.FullMessageSerializer;
import org.apache.ignite.internal.util.distributed.InitMessage;
Expand Down Expand Up @@ -287,6 +301,10 @@ public DiscoveryMessageFactory(Marshaller marsh, ClassLoader clsLdr) {

factory.register(86, GridCacheVersion::new, new GridCacheVersionSerializer());

factory.register(167, ServiceDeploymentProcessId::new, new ServiceDeploymentProcessIdSerializer());
factory.register(169, ServiceSingleNodeDeploymentResult::new, new ServiceSingleNodeDeploymentResultSerializer());
factory.register(170, ServiceClusterDeploymentResult::new, new ServiceClusterDeploymentResultSerializer());

// DiscoveryCustomMessage
factory.register(500, CacheStatisticsModeChangeMessage::new, new CacheStatisticsModeChangeMessageSerializer());
factory.register(501, SecurityAwareCustomMessageWrapper::new,
Expand Down Expand Up @@ -330,7 +348,12 @@ public DiscoveryMessageFactory(Marshaller marsh, ClassLoader clsLdr) {
new ChangeGlobalStateMessageMarshallableSerializer(marsh, clsLdr));
factory.register(533, ClientCacheChangeDummyDiscoveryMessage::new,
new ClientCacheChangeDummyDiscoveryMessageMarshallableSerializer(marsh, clsLdr));
factory.register(534, DynamicCacheChangeBatch::new,
new DynamicCacheChangeBatchMarshallableSerializer(marsh, clsLdr));
factory.register(534, DynamicCacheChangeBatch::new, new DynamicCacheChangeBatchMarshallableSerializer(marsh, clsLdr));
factory.register(535, ServiceClusterDeploymentResultBatch::new,
new ServiceClusterDeploymentResultBatchSerializer());
factory.register(536, ServiceChangeBatchRequest::new, new ServiceChangeBatchRequestSerializer());
factory.register(537, ServiceDeploymentRequest::new,
new ServiceDeploymentRequestMarshallableSerializer(marsh, clsLdr));
factory.register(538, ServiceUndeploymentRequest::new, new ServiceUndeploymentRequestSerializer());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,18 @@

package org.apache.ignite.internal.processors.service;

import java.io.Serializable;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.NotNull;
import org.apache.ignite.plugin.extensions.communication.Message;

/**
* Abstract class for service change requests.
*/
abstract class ServiceChangeAbstractRequest implements Serializable {
/** */
private static final long serialVersionUID = 0L;

abstract class ServiceChangeAbstractRequest implements Message {
/** Service id. */
protected final IgniteUuid srvcId;

/**
* @param srvcId Service id.
*/
protected ServiceChangeAbstractRequest(@NotNull IgniteUuid srvcId) {
this.srvcId = srvcId;
}
@Order(0)
IgniteUuid srvcId;

/**
* @return Service id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,48 @@

import java.util.Collection;
import java.util.Collections;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.jetbrains.annotations.Nullable;

/**
* Service change batch request discovery message.
*/
public class ServiceChangeBatchRequest implements DiscoveryCustomMessage {
public class ServiceChangeBatchRequest implements DiscoveryCustomMessage, Message {
/** */
private static final long serialVersionUID = 0L;

/** Unique custom message ID. */
private final IgniteUuid id = IgniteUuid.randomUuid();
@Order(0)
IgniteUuid id;

/** Change requests. */
@GridToStringInclude
private final Collection<ServiceChangeAbstractRequest> reqs;
@Order(1)
Collection<ServiceChangeAbstractRequest> reqs;

/** Services deployment actions to be processed on services deployment process. */
@GridToStringExclude
@Nullable private transient ServiceDeploymentActions serviceDeploymentActions;
@Nullable private ServiceDeploymentActions serviceDeploymentActions;

/** Default constructor for {@link MessageFactory}. */
public ServiceChangeBatchRequest() {
}

/**
* @param reqs Change requests.
*/
public ServiceChangeBatchRequest(Collection<ServiceChangeAbstractRequest> reqs) {
assert !F.isEmpty(reqs);

id = IgniteUuid.randomUuid();
this.reqs = reqs;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,35 @@

package org.apache.ignite.internal.processors.service;

import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import java.util.UUID;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.jetbrains.annotations.NotNull;

/**
* Service cluster deployment result.
* <p/>
* Contains coint of deployed service and deployment errors across the cluster mapped to nodes ids.
*/
public class ServiceClusterDeploymentResult implements Serializable {
/** */
private static final long serialVersionUID = 0L;

public class ServiceClusterDeploymentResult implements Message {
/** Service id. */
private final IgniteUuid srvcId;
@Order(0)
IgniteUuid srvcId;

/** Per node deployments results. */
@Order(1)
@GridToStringInclude
private final Map<UUID, ServiceSingleNodeDeploymentResult> results;
Map<UUID, ServiceSingleNodeDeploymentResult> results;

/** Default constructor for {@link MessageFactory}. */
public ServiceClusterDeploymentResult() {
}

/**
* @param srvcId Service id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
package org.apache.ignite.internal.processors.service;

import java.util.Collection;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -31,30 +34,38 @@
* <p/>
* Contains collection of {@link ServiceClusterDeploymentResult}.
*/
public class ServiceClusterDeploymentResultBatch implements DiscoveryCustomMessage {
public class ServiceClusterDeploymentResultBatch implements DiscoveryCustomMessage, Message {
/** */
private static final long serialVersionUID = 0L;

/** Unique custom message ID. */
private final IgniteUuid id = IgniteUuid.randomUuid();
@Order(0)
IgniteUuid id;

/** Deployment process id. */
private final ServiceDeploymentProcessId depId;
@Order(1)
ServiceDeploymentProcessId depId;

/** Services deployments results. */
@Order(2)
@GridToStringInclude
private Collection<ServiceClusterDeploymentResult> results;
Collection<ServiceClusterDeploymentResult> results;

/** Services deployment actions to be processed on services deployment process. */
@GridToStringExclude
@Nullable private transient ServiceDeploymentActions serviceDeploymentActions;
@Nullable private ServiceDeploymentActions serviceDeploymentActions;

/** Default constructor for {@link MessageFactory}. */
public ServiceClusterDeploymentResultBatch() {
}

/**
* @param depId Deployment process id.
* @param results Services deployments results.
*/
public ServiceClusterDeploymentResultBatch(@NotNull ServiceDeploymentProcessId depId,
@NotNull Collection<ServiceClusterDeploymentResult> results) {
this.id = IgniteUuid.randomUuid();
this.depId = depId;
this.results = results;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,37 @@

package org.apache.ignite.internal.processors.service;

import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.MarshallableMessage;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.jetbrains.annotations.NotNull;

/**
* Service deployment request.
*/
public class ServiceDeploymentRequest extends ServiceChangeAbstractRequest {
/** */
private static final long serialVersionUID = 0L;

public class ServiceDeploymentRequest extends ServiceChangeAbstractRequest implements MarshallableMessage {
/** Service configuration. */
private final LazyServiceConfiguration cfg;
private LazyServiceConfiguration cfg;

/** JDK serialization for {@link #cfg}. */
@Order(0)
byte[] cfgBytes;

/** Default constructor for {@link MessageFactory}. */
public ServiceDeploymentRequest() {
}

/**
* @param srvcId Service id.
* @param cfg Service configuration.
*/
public ServiceDeploymentRequest(@NotNull IgniteUuid srvcId, @NotNull LazyServiceConfiguration cfg) {
super(srvcId);

this.srvcId = srvcId;
this.cfg = cfg;
}

Expand All @@ -48,6 +58,18 @@ public LazyServiceConfiguration configuration() {
return cfg;
}

/** {@inheritDoc} */
@Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException {
if (cfg != null)
cfgBytes = U.marshal(marsh, cfg);
}

/** {@inheritDoc} */
@Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException {
if (cfgBytes != null)
cfg = U.unmarshal(marsh, cfgBytes, clsLdr);
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(ServiceDeploymentRequest.class, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@

import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
import org.jetbrains.annotations.NotNull;

/**
* Service undeployment request.
*/
public class ServiceUndeploymentRequest extends ServiceChangeAbstractRequest {
/** */
private static final long serialVersionUID = 0L;
/** Default constructor for {@link MessageFactory}. */
public ServiceUndeploymentRequest() {
}

/**
* @param srvcId Service id.
*/
public ServiceUndeploymentRequest(@NotNull IgniteUuid srvcId) {
super(srvcId);
this.srvcId = srvcId;
}

/** {@inheritDoc} */
Expand Down