/** Metrics returns an UnmodifiableMap. * Unmodifiable maps should not be serialized with type, because UnmodifiableMap cannot be deserialized. * So we convert to HashMap. */ private HashMap convertMap(Map<String, Object> map) { HashMap retVal = new HashMap(map); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getValue() instanceof Map) { retVal.put(entry.getKey(), convertMap((Map<String, Object>) entry.getValue())); } } return retVal; } }
/** Metrics returns an UnmodifiableMap. * Unmodifiable maps should not be serialized with type, because UnmodifiableMap cannot be deserialized. * So we convert to HashMap. */ private HashMap convertMap(Map<String, Object> map) { HashMap retVal = new HashMap(map); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getValue() instanceof Map) { retVal.put(entry.getKey(), convertMap((Map<String, Object>) entry.getValue())); } } return retVal; } }
/** Metrics returns an UnmodifiableMap. * Unmodifiable maps should not be serialized with type, because UnmodifiableMap cannot be deserialized. * So we convert to HashMap. */ private HashMap convertMap(Map<String, Object> map) { HashMap retVal = new HashMap(map); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getValue() instanceof Map) { retVal.put(entry.getKey(), convertMap((Map<String, Object>) entry.getValue())); } } return retVal; } }
/** Metrics returns an UnmodifiableMap. * Unmodifiable maps should not be serialized with type, because UnmodifiableMap cannot be deserialized. * So we convert to HashMap. */ private HashMap convertMap(Map<String, Object> map) { HashMap retVal = new HashMap(map); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getValue() instanceof Map) { retVal.put(entry.getKey(), convertMap((Map<String, Object>) entry.getValue())); } } return retVal; } }
@Override public byte[] toBytes(MetricsSnapshot metricsSnapshot) { try { return objectMapper.writeValueAsString(convertMap(metricsSnapshot.getAsMap())).getBytes("UTF-8"); } catch (IOException e) { LOG.info("Exception while serializing", e); } return null; }
/** Metrics returns an UnmodifiableMap. * Unmodifiable maps should not be serialized with type, because UnmodifiableMap cannot be deserialized. * So we convert to HashMap. */ private HashMap convertMap(Map<String, Object> map) { HashMap retVal = new HashMap(map); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getValue() instanceof Map) { retVal.put(entry.getKey(), convertMap((Map<String, Object>) entry.getValue())); } } return retVal; } }
@Override public byte[] toBytes(MetricsSnapshot metricsSnapshot) { try { return objectMapper.writeValueAsString(convertMap(metricsSnapshot.getAsMap())).getBytes("UTF-8"); } catch (IOException e) { LOG.info("Exception while serializing", e); } return null; }
@Override public byte[] toBytes(MetricsSnapshot metricsSnapshot) { try { return objectMapper.writeValueAsString(convertMap(metricsSnapshot.getAsMap())).getBytes("UTF-8"); } catch (IOException e) { LOG.info("Exception while serializing", e); } return null; }
@Override public byte[] toBytes(MetricsSnapshot metricsSnapshot) { try { return objectMapper.writeValueAsString(convertMap(metricsSnapshot.getAsMap())).getBytes("UTF-8"); } catch (IOException e) { LOG.info("Exception while serializing", e); } return null; }
@Override public byte[] toBytes(MetricsSnapshot metricsSnapshot) { try { return objectMapper.writeValueAsString(convertMap(metricsSnapshot.getAsMap())).getBytes("UTF-8"); } catch (IOException e) { LOG.info("Exception while serializing", e); } return null; }