/** * checks to see if this thread needs to masquerade as a transactional thread. * clients after GFE_66 should be able to start a transaction. * @param msg * @param servConn * @return true if thread should masquerade as a transactional thread. */ protected boolean shouldMasqueradeForTx(Message msg, ServerConnection servConn) { if (servConn.getClientVersion().compareTo(Version.GFE_66) >= 0 && msg.getTransactionId() != TXManagerImpl.NO_TX) { return true; } return false; }
/** * checks to see if this thread needs to masquerade as a transactional thread. * clients after GFE_66 should be able to start a transaction. * @param msg * @param servConn * @return true if thread should masquerade as a transactional thread. */ protected boolean shouldMasqueradeForTx(Message msg, ServerConnection servConn) { if (servConn.getClientVersion().compareTo(Version.GFE_66) >= 0 && msg.getTransactionId() > TXManagerImpl.NOTX) { return true; } return false; }
@Override public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException { logger.error(LocalizedMessage.create(LocalizedStrings.Invalid_0_INVALID_MESSAGE_TYPE_WITH_TX_1_FROM_2, new Object[] {servConn.getName(), Integer.valueOf(msg.getTransactionId()), servConn.getSocketString()})); writeErrorResponse(msg, MessageType.INVALID, servConn); }
private static void writeContainsKeyResponse(boolean containsKey, Message origMsg, ServerConnection servConn) throws IOException { LogWriterI18n logger = servConn.getLogger(); Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.addObjPart(containsKey ? Boolean.TRUE : Boolean.FALSE); responseMsg.send(servConn, logger, origMsg.getTransactionId()); }
private static void writeContainsKeyResponse(boolean containsKey, Message origMsg, ServerConnection servConn) throws IOException { LogWriterI18n logger = servConn.getLogger(); Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.addObjPart(containsKey ? Boolean.TRUE : Boolean.FALSE); responseMsg.send(servConn, logger, origMsg.getTransactionId()); }
private static void writeSizeResponse(Integer sizeCount, Message origMsg, ServerConnection servConn) throws IOException { LogWriterI18n logger = servConn.getLogger(); Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.addObjPart(sizeCount); responseMsg.send(servConn, logger, origMsg.getTransactionId()); }
@Override public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException { if (logger.errorEnabled()) { logger.error( LocalizedStrings.Invalid_0_INVALID_MESSAGE_TYPE_WITH_TX_1_FROM_2, new Object[] {servConn.getName(), Integer.valueOf(msg.getTransactionId()), servConn.getSocketString()}); } writeErrorResponse(msg, MessageType.INVALID, servConn); }
@Override public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException { // requiresResponse = true; NOT NEEDED... ALWAYS SEND ERROR RESPONSE if (logger.severeEnabled()) { logger.severe( LocalizedStrings.Default_0_UNKNOWN_MESSAGE_TYPE_1_WITH_TX_2_FROM_3, new Object[] {servConn.getName(), MessageType.getString(msg.getMessageType()), Integer.valueOf(msg.getTransactionId()), servConn.getSocketString()}); } writeErrorResponse(msg, MessageType.UNKNOWN_MESSAGE_TYPE_ERROR, servConn); // responded = true; NOT NEEDED... ALWAYS SEND ERROR RESPONSE }
@Override public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException { // requiresResponse = true; NOT NEEDED... ALWAYS SEND ERROR RESPONSE logger.fatal(LocalizedMessage.create(LocalizedStrings.Default_0_UNKNOWN_MESSAGE_TYPE_1_WITH_TX_2_FROM_3, new Object[] {servConn.getName(), MessageType.getString(msg.getMessageType()), Integer.valueOf(msg.getTransactionId()), servConn.getSocketString()})); writeErrorResponse(msg, MessageType.UNKNOWN_MESSAGE_TYPE_ERROR, servConn); // responded = true; NOT NEEDED... ALWAYS SEND ERROR RESPONSE }
/** * Sets the transaction id on the message */ private void setMsgTransactionId() { if (participateInTransaction() && getMessage().getTransactionId() == TXManagerImpl.NOTX) { getMessage().setTransactionId(TXManagerImpl.getCurrentTXUniqueId()); } }
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); }
protected static void writeErrorResponse(Message origMsg, int messageType, String msg, ServerConnection servConn) throws IOException { Message errorMsg = servConn.getErrorResponseMessage(); errorMsg.setMessageType(messageType); errorMsg.setNumberOfParts(1); errorMsg.setTransactionId(origMsg.getTransactionId()); errorMsg.addStringPart(msg); errorMsg.send(servConn); }
protected static void writeErrorResponse(Message origMsg, int messageType, String msg, ServerConnection servConn) throws IOException { Message errorMsg = servConn.getErrorResponseMessage(); errorMsg.setMessageType(messageType); errorMsg.setNumberOfParts(1); errorMsg.setTransactionId(origMsg.getTransactionId()); errorMsg.addStringPart(msg); errorMsg.send(servConn); }
/** * Sets the transaction id on the message */ private void setMsgTransactionId() { if (participateInTransaction() && getMessage().getTransactionId() == TXManagerImpl.NO_TX) { final TXId txId = TXManagerImpl.getCurrentTXId(); if (txId != null) { // TODO: merge: client TX should be updated to deal with full TXIds getMessage().setTransactionId(txId.getUniqId()); } } }
protected static void writeErrorResponse(Message origMsg, int messageType, ServerConnection servConn) throws IOException { Message errorMsg = servConn.getErrorResponseMessage(); errorMsg.setMessageType(messageType); errorMsg.setNumberOfParts(1); errorMsg.setTransactionId(origMsg.getTransactionId()); errorMsg .addStringPart(LocalizedStrings.BaseCommand_INVALID_DATA_RECEIVED_PLEASE_SEE_THE_CACHE_SERVER_LOG_FILE_FOR_ADDITIONAL_DETAILS.toLocalizedString()); errorMsg.send(servConn); }
protected static void writeErrorResponse(Message origMsg, int messageType, ServerConnection servConn) throws IOException { Message errorMsg = servConn.getErrorResponseMessage(); errorMsg.setMessageType(messageType); errorMsg.setNumberOfParts(1); errorMsg.setTransactionId(origMsg.getTransactionId()); errorMsg .addStringPart(LocalizedStrings.BaseCommand_INVALID_DATA_RECEIVED_PLEASE_SEE_THE_CACHE_SERVER_LOG_FILE_FOR_ADDITIONAL_DETAILS.toLocalizedString()); errorMsg.send(servConn); }
private static void writeContainsKeyResponse(boolean containsKey, Message origMsg, ServerConnection servConn) throws IOException { LogWriterI18n logger = servConn.getLogWriter(); Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.addObjPart(containsKey ? Boolean.TRUE : Boolean.FALSE); responseMsg.send(servConn); }
private static void writeContainsKeyResponse(boolean containsKey, Message origMsg, ServerConnection servConn) throws IOException { LogWriterI18n logger = servConn.getLogWriter(); Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.addObjPart(containsKey ? Boolean.TRUE : Boolean.FALSE); responseMsg.send(servConn); }
protected static void writeResponseWithFunctionAttribute(byte[] data, Message origMsg, ServerConnection servConn) throws IOException { Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.setNumberOfParts(1); responseMsg.addBytesPart(data); servConn.getCache().getCancelCriterion().checkCancelInProgress(null); responseMsg.send(servConn); origMsg.flush(); }
protected static void writeResponseWithFunctionAttribute(byte[] data, Message origMsg, ServerConnection servConn) throws IOException { Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.setNumberOfParts(1); responseMsg.addBytesPart(data); servConn.getCache().getCancelCriterion().checkCancelInProgress(null); responseMsg.send(servConn); origMsg.clearParts(); }