use of org.apache.geode.internal.cache.tier.sockets.Message in project geode by apache.
the class GetPDXTypeById method cmdExecute.
@Override
public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException, ClassNotFoundException {
serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
logger.debug("{}: Received get pdx type by id request ({} parts) from {}", serverConnection.getName(), clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
int pdxId = clientMessage.getPart(0).getInt();
PdxType type;
try {
InternalCache cache = serverConnection.getCache();
TypeRegistry registry = cache.getPdxRegistry();
type = registry.getType(pdxId);
} catch (Exception e) {
writeException(clientMessage, e, false, serverConnection);
serverConnection.setAsTrue(RESPONDED);
return;
}
Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.addObjPart(type);
responseMsg.send(serverConnection);
serverConnection.setAsTrue(RESPONDED);
}
use of org.apache.geode.internal.cache.tier.sockets.Message in project geode by apache.
the class GetPdxEnums70 method cmdExecute.
@Override
public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException, ClassNotFoundException {
serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
logger.debug("{}: Received get pdx enums from {}", serverConnection.getName(), serverConnection.getSocketString());
}
Map<Integer, EnumInfo> enums;
try {
InternalCache cache = serverConnection.getCache();
enums = cache.getPdxRegistry().enumMap();
} catch (Exception e) {
writeException(clientMessage, e, false, serverConnection);
serverConnection.setAsTrue(RESPONDED);
return;
}
Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.addObjPart(enums);
responseMsg.send(serverConnection);
serverConnection.setAsTrue(RESPONDED);
}
use of org.apache.geode.internal.cache.tier.sockets.Message in project geode by apache.
the class AbstractOp method attemptReadResponse.
/**
* Attempts to read a response to this operation by reading it from the given connection, and
* returning it.
*
* @param cnx the connection to read the response from
* @return the result of the operation or <code>null</code> if the operation has no result.
* @throws Exception if the execute failed
*/
protected Object attemptReadResponse(Connection cnx) throws Exception {
Message msg = createResponseMessage();
if (msg != null) {
msg.setComms(cnx.getSocket(), cnx.getInputStream(), cnx.getOutputStream(), cnx.getCommBuffer(), cnx.getStats());
if (msg instanceof ChunkedMessage) {
try {
return processResponse(msg, cnx);
} finally {
msg.unsetComms();
processSecureBytes(cnx, msg);
}
} else {
try {
msg.recv();
} finally {
msg.unsetComms();
processSecureBytes(cnx, msg);
}
return processResponse(msg, cnx);
}
} else {
return null;
}
}
use of org.apache.geode.internal.cache.tier.sockets.Message in project geode by apache.
the class Size method writeSizeResponse.
private static void writeSizeResponse(Integer sizeCount, Message origMsg, ServerConnection servConn) throws IOException {
Message responseMsg = servConn.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
responseMsg.setTransactionId(origMsg.getTransactionId());
responseMsg.addObjPart(sizeCount);
responseMsg.send(servConn);
}
use of org.apache.geode.internal.cache.tier.sockets.Message in project geode by apache.
the class Put65 method writeReply.
protected void writeReply(Message origMsg, ServerConnection servConn, boolean sendOldValue, boolean oldValueIsObject, Object oldValue, VersionTag tag) throws IOException {
Message replyMsg = servConn.getReplyMessage();
servConn.getCache().getCancelCriterion().checkCancelInProgress(null);
replyMsg.setMessageType(MessageType.REPLY);
replyMsg.setNumberOfParts(sendOldValue ? 3 : 1);
replyMsg.setTransactionId(origMsg.getTransactionId());
replyMsg.addBytesPart(okBytes());
if (sendOldValue) {
replyMsg.addIntPart(oldValueIsObject ? 1 : 0);
replyMsg.addObjPart(oldValue);
}
replyMsg.send(servConn);
if (logger.isTraceEnabled()) {
logger.trace("{}: rpl tx: {} parts={}", servConn.getName(), origMsg.getTransactionId(), replyMsg.getNumberOfParts());
}
}
Aggregations