// FIXME: check that handleError is aborting on GOSSIP_IO_ERROR
// handleError(GOSSIP_IO_ERROR, e);
private <T extends Serializable> void sendObject(CommunicationPatternAgent agent,
      Connection connection,
      String logMessageName, T obj) throws FatalErrorHalt, AbortRound {
    byte[] data = null;
    data = agent.serialize(obj);
    logJson(LogFlag.serialization, "mica-serialize-bytes-" + logMessageName, data.length);
    byte[] lengthBytes = serializeInteger(data.length);
    try {
      connection.getOutputStream().write(lengthBytes);
      connection.getOutputStream().write(data);
    } catch (SocketException se) {
      // FIXME: check that handleError is aborting on GOSSIP_IO_ERROR
      // handleError(GOSSIP_IO_ERROR, se);
      handleError(GOSSIP_IO_ERROR, new AbortRound());
    } catch (IOException e) {
      // FIXME: check that handleError is aborting on GOSSIP_IO_ERROR
      // handleError(GOSSIP_IO_ERROR, e);
      handleError(GOSSIP_IO_ERROR, new AbortRound());
    }
  }
connection.getOutputStream().write(data);
} catch (SocketException se) {
// FIXME: check that handleError is aborting on GOSSIP_IO_ERROR
// handleError(GOSSIP_IO_ERROR, se);
handleError(GOSSIP_IO_ERROR, new AbortRound());
} catch (IOException e) {
Connection connection,
String logMessageName, T obj) throws FatalErrorHalt, AbortRound {
byte[] data = null;
data = agent.serialize(obj);
logJson(LogFlag.serialization, "mica-serialize-bytes-" + logMessageName, data.length);
byte[] lengthBytes = serializeInteger(data.length);
try {
connection.getOutputStream().write(lengthBytes);
connection.getOutputStream().write(data);
} catch (SocketException se) {
// FIXME: check that handleError is aborting on GOSSIP_IO_ERROR
// handleError(GOSSIP_IO_ERROR, se);
handleError(GOSSIP_IO_ERROR, new AbortRound());
} catch (IOException e) {
// FIXME: check that handleError is aborting on GOSSIP_IO_ERROR
// handleError(GOSSIP_IO_ERROR, e);
handleError(GOSSIP_IO_ERROR, new AbortRound());
}
}
private <T extends Serializable> void sendObject(CommunicationPatternAgent agent,
Connection connection,
String logMessageName, T obj) throws FatalErrorHalt, AbortRound {
byte[] data = null;
data = agent.serialize(obj);
logJson(LogFlag.serialization, "mica-serialize-bytes-" + logMessageName, data.length);
byte[] lengthBytes = serializeInteger(data.length);
try {
connection.getOutputStream().write(lengthBytes);
connection.getOutputStream().write(data);
} catch (SocketException se) {
// FIXME: check that handleError is aborting on GOSSIP_IO_ERROR
// handleError(GOSSIP_IO_ERROR, se);
handleError(GOSSIP_IO_ERROR, new AbortRound());
} catch (IOException e) {
// FIXME: check that handleError is aborting on GOSSIP_IO_ERROR
// handleError(GOSSIP_IO_ERROR, e);
handleError(GOSSIP_IO_ERROR, new AbortRound());
}
}