org.gridgain.grid.kernal.GridTaskCancelRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gridgain-hadoop2 Show documentation
Show all versions of gridgain-hadoop2 Show documentation
Java-based middleware for in-memory processing of big data in a distributed environment.
/*
Copyright (C) GridGain Systems. All Rights Reserved.
Licensed 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.gridgain.grid.kernal;
import org.gridgain.grid.*;
import org.gridgain.grid.util.direct.*;
import org.gridgain.grid.util.typedef.internal.*;
import java.io.*;
import java.nio.*;
/**
* Request for cancelling tasks.
*/
public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter {
/** */
private GridUuid 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(GridUuid sesId) {
assert sesId != null;
this.sesId = sesId;
}
/**
* Gets execution ID of task to be cancelled.
*
* @return Execution ID of task to be cancelled.
*/
public GridUuid 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()))
return false;
commState.typeWritten = true;
}
switch (commState.idx) {
case 0:
if (!commState.putGridUuid(sesId))
return false;
commState.idx++;
}
return true;
}
/** {@inheritDoc} */
@SuppressWarnings("all")
@Override public boolean readFrom(ByteBuffer buf) {
commState.setBuffer(buf);
switch (commState.idx) {
case 0:
GridUuid sesId0 = commState.getGridUuid();
if (sesId0 == GRID_UUID_NOT_READ)
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);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy