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); }
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); }
private void writeReply(Message msg, ServerConnection servConn, int batchId, int numberOfEvents) throws IOException { Message replyMsg = servConn.getResponseMessage(); replyMsg.setMessageType(MessageType.REPLY); replyMsg.setTransactionId(msg.getTransactionId()); replyMsg.setNumberOfParts(2); replyMsg.addIntPart(batchId); replyMsg.addIntPart(numberOfEvents); replyMsg.setTransactionId(msg.getTransactionId()); replyMsg.send(servConn); servConn.setAsTrue(Command.RESPONDED); if (logger.isDebugEnabled()) { logger.debug("{}: rpl tx: {} batchId {} numberOfEvents: {}", servConn.getName(), msg.getTransactionId(), batchId, numberOfEvents); } }
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()); }
protected static void writeCommitResponse(TXCommitMessage response, Message origMsg, ServerConnection servConn) throws IOException { Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.setNumberOfParts(1); if( response != null ) { response.setClientVersion(servConn.getClientVersion()); } responseMsg.addObjPart(response, zipValues); servConn.getCache().getCancelCriterion().checkCancelInProgress(null); if (logger.isDebugEnabled()) { logger.debug("TX: sending a nonNull response for transaction: {}", new TXId((InternalDistributedMember) servConn.getProxyID().getDistributedMember(), origMsg.getTransactionId())); } responseMsg.send(servConn); origMsg.clearParts(); }
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(); }
@Override public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, ClassNotFoundException { servConn.setAsTrue(REQUIRES_RESPONSE); if (logger.isDebugEnabled()) { logger.debug("{}: Received get pdx types from {}", servConn.getName(), servConn.getSocketString()); } Map<Integer, PdxType> types; try { GemFireCacheImpl cache = (GemFireCacheImpl) servConn.getCache(); types = cache.getPdxRegistry().typeMap(); } catch (Exception e) { writeException(msg, e, false, servConn); servConn.setAsTrue(RESPONDED); return; } Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1); responseMsg.setTransactionId(msg.getTransactionId()); responseMsg.addObjPart(types); responseMsg.send(servConn); servConn.setAsTrue(RESPONDED); } }
@Override public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, ClassNotFoundException { servConn.setAsTrue(REQUIRES_RESPONSE); if (logger.isDebugEnabled()) { logger.debug("{}: Received get pdx enums from {}", servConn.getName(), servConn.getSocketString()); } Map<Integer, EnumInfo> enums; try { GemFireCacheImpl cache = (GemFireCacheImpl) servConn.getCache(); enums = cache.getPdxRegistry().enumMap(); } catch (Exception e) { writeException(msg, e, false, servConn); servConn.setAsTrue(RESPONDED); return; } Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1); responseMsg.setTransactionId(msg.getTransactionId()); responseMsg.addObjPart(enums); responseMsg.send(servConn); servConn.setAsTrue(RESPONDED); } }
protected static void writeResponseWithRefreshMetadata(Object data, Object callbackArg, Message origMsg, boolean isObject, ServerConnection servConn, PartitionedRegion pr, byte nwHop) throws IOException { Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); if (callbackArg == null) { responseMsg.setNumberOfParts(2); } else { responseMsg.setNumberOfParts(3); } if (data instanceof byte[]) { responseMsg.addRawPart((byte[])data, isObject); } else { Assert.assertTrue(isObject, "isObject should be true when value is not a byte[]"); responseMsg.addObjPart(data, zipValues); } if (callbackArg != null) { responseMsg.addObjPart(callbackArg); } responseMsg.addBytesPart(new byte[]{pr.getMetadataVersion().byteValue(),nwHop}); servConn.getCache().getCancelCriterion().checkCancelInProgress(null); responseMsg.send(servConn); origMsg.flush(); }
protected static void writeResponseWithRefreshMetadata(Object data, Object callbackArg, Message origMsg, boolean isObject, ServerConnection servConn, PartitionedRegion pr, byte nwHop) throws IOException { Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); if (callbackArg == null) { responseMsg.setNumberOfParts(2); } else { responseMsg.setNumberOfParts(3); } if (data instanceof byte[]) { responseMsg.addRawPart((byte[])data, isObject); } else { Assert.assertTrue(isObject, "isObject should be true when value is not a byte[]"); responseMsg.addObjPart(data, zipValues); } if (callbackArg != null) { responseMsg.addObjPart(callbackArg); } responseMsg.addBytesPart(new byte[]{pr.getMetadataVersion().byteValue(),nwHop}); servConn.getCache().getCancelCriterion().checkCancelInProgress(null); responseMsg.send(servConn); origMsg.clearParts(); }
private void writeReply(Message msg, ServerConnection servConn, int batchId, int numberOfEvents) throws IOException { Message replyMsg = servConn.getResponseMessage(); replyMsg.setMessageType(MessageType.REPLY); replyMsg.setTransactionId(msg.getTransactionId()); replyMsg.setNumberOfParts(2); replyMsg.addIntPart(batchId); replyMsg.addIntPart(numberOfEvents); replyMsg.setTransactionId(msg.getTransactionId()); replyMsg.send(servConn); servConn.setAsTrue(Command.RESPONDED); if (logger.fineEnabled()) { logger.fine(servConn.getName() + ": rpl tx: " + msg.getTransactionId() + " batchId " + batchId + " numberOfEvents :" + numberOfEvents); } }
protected static void writeCommitResponse(TXRemoteCommitMessage response, Message origMsg, ServerConnection servConn) throws IOException { LogWriterI18n logger = servConn.getLogger(); Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.setNumberOfParts(1); //response.setClientVersion(servConn.getClientVersion()); responseMsg.addObjPart(response, zipValues); servConn.getCache().getCancelCriterion().checkCancelInProgress(null); if (logger.fineEnabled()) { logger.fine("TX: sending a " + (response == null ? "null" : "nonNull") + " for transaction:" + origMsg.getTransactionId()); /* TODO: merge: update for client TX + new TXId((InternalDistributedMember) servConn.getProxyID() .getDistributedMember(), origMsg.getTransactionId())); */ } responseMsg.send(servConn); origMsg.flush(); }
protected static void writeResponse(Object data, Object callbackArg, Message origMsg, boolean isObject, ServerConnection servConn) throws IOException { Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); if (callbackArg == null) { responseMsg.setNumberOfParts(1); } else { responseMsg.setNumberOfParts(2); } if (data instanceof byte[]) { responseMsg.addRawPart((byte[])data, isObject); } else { Assert.assertTrue(isObject, "isObject should be true when value is not a byte[]"); responseMsg.addObjPart(data, zipValues); } if (callbackArg != null) { responseMsg.addObjPart(callbackArg); } servConn.getCache().getCancelCriterion().checkCancelInProgress(null); responseMsg.send(servConn); origMsg.flush(); }
@Override public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, ClassNotFoundException { servConn.setAsTrue(REQUIRES_RESPONSE); if (logger.fineEnabled()) { logger.fine(servConn.getName() + ": Received get pdx types from " + servConn.getSocketString()); } Map<Integer, PdxType> types; try { GemFireCacheImpl cache = (GemFireCacheImpl) servConn.getCache(); types = cache.getPdxRegistry().typeMap(); } catch (Exception e) { writeException(msg, e, false, servConn); servConn.setAsTrue(RESPONDED); return; } Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1); responseMsg.setTransactionId(msg.getTransactionId()); responseMsg.addObjPart(types); responseMsg.send(servConn, logger, msg.getTransactionId()); servConn.setAsTrue(RESPONDED); } }
Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1);
Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setNumberOfParts(1);