public byte[] serialize(Object object) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Collection<JavaEEObjectStreamHandler> handlers = new ArrayList<>();
handlers.add(getHandler());
JavaEEObjectOutputStream oos = new JavaEEObjectOutputStream(baos,
true, handlers);
oos.writeObject(object);
return baos.toByteArray();
} catch (Exception e) {
LOG.warn(
"Caught Exception attempting to serialize. Falling Back\n {} ",
e);