}
public GPacket getReplyGPacket(int status, String reason, ArrayList[] aes) {
assert ( pkt != null );
GPacket gp = GPacket.getInstance();
gp.setType(ProtocolGlobals.G_MESSAGE_ACK_REPLY);
gp.putProp("X", (Long)pkt.getProp("X"));
gp.putProp("T", new Integer(getAckType()));
if (pkt.getProp("C") != null) {
gp.putProp("C", pkt.getProp("C"));
}
if (pkt.getProp("messageBrokerSession") != null) {
gp.putProp("messageBrokerSession", pkt.getProp("messageBrokerSession"));
}
if (pkt.getProp("messageStoreSession") != null) {
gp.putProp("messageStoreSession", pkt.getProp("messageStoreSession"));
}
if (pkt.getProp("transactionID") != null) {
gp.putProp("transactionID", pkt.getProp("transactionID"));
}
if (pkt.getProp("ackackAsync") != null) {
gp.putProp("ackackAsync", pkt.getProp("ackackAsync"));
}
gp.putProp("S", new Integer(status));
if (reason != null) gp.putProp("reason", reason);
if (aes == null) {
if (pkt.getPayload() != null) {
gp.setPayload(ByteBuffer.wrap(pkt.getPayload().array()));
}
return gp;
}
gp.putProp("notfound", new Integer(aes[0].size()));
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
for (int i = 0; i < aes[0].size(); i++) {
((SysMessageID)aes[0].get(i)).writeID(dos);
ClusterConsumerInfo.writeConsumerUID((
com.sun.messaging.jmq.jmsserver.core.ConsumerUID)aes[1].get(i), dos);
}
dos.flush();
bos.flush();
byte[] buf = bos.toByteArray();
gp.setPayload(ByteBuffer.wrap(buf));
} catch (Exception e) {
Globals.getLogger().logStack(Globals.getLogger().WARNING, e.getMessage(), e);
}
return gp;