/** * {@inheritDoc} */ @Override @SuppressWarnings("rawtypes") public void write(Kryo kryo, Output output, Collection collection) { if (null != hibernateUtil) { if (hibernateUtil.isPersistentCollection(collection.getClass()) && !hibernateUtil.isInitialized(collection)) { // if Hibernate collection is not initialized just write the empty collection int length = 0; output.writeInt(length, true); return; } } super.write(kryo, output, collection); }
/** * {@inheritDoc} */ @SuppressWarnings("rawtypes") @Override public void write(Kryo kryo, Output output, Map map) { if (null != hibernateUtil) { if (hibernateUtil.isPersistentMap(map.getClass()) && !hibernateUtil.isInitialized(map)) { // if Hibernate map is not initialized just write the empty map int length = 0; output.writeInt(length, true); return; } } super.write(kryo, output, map); } }