String from,
Serializable payload,
BamError error)
{
try {
JsonOutput out = _out;
if (out == null)
return;
out.init(os);
if (log.isLoggable(Level.FINER)) {
log.finer(this + " query_error " + error + "\n " + payload + "\n "
+ " {id: " + id + ", to:" + to + ", from:" + from + "}");
}
os.print("[\"query_error\"");
if (to != null) {
os.print(",\"");
os.print(to);
os.print("\"");
}
else {
os.print(",null");
}
if (from != null) {
os.print(",\"");
os.print(from);
os.print("\"");
}
os.print(",");
os.print(id);
os.write(",\"");
writeType(os, payload);
os.print("\",");
out.writeObject(payload);
out.flushBuffer();
os.print(",");
out.writeObject(error);
out.flushBuffer();
os.print("]");
} catch (IOException e) {
throw new ProtocolException(e);
}