@Override
    public String toString() {
        // Spark's background logging apparently tries to log a `toString()` of certain objects while they're being
        // modified, which then throws a ConcurrentModificationException. We probably can't make any arbitrary object
        // thread-safe, but we can easily retry on such cases and eventually we should always get a result.
        final int maxAttempts = 5;
        for (int i = maxAttempts; ;) {
            try {
                return shrinkedToString();
            }
            catch (ConcurrentModificationException cme) {
                if (--i > 0) {
                    logger.warn(String.format("Failed to toString() object held by ObjectWritable, retrying %d more %s.",
                            i, i == 1 ? "time" : "times"), cme);
                } else break;
                if (i < maxAttempts - 1) {
                    try {
                        Thread.sleep((maxAttempts - i - 1) * 100);
                    } catch (InterruptedException ignored) {
                        break;
                    }
                }
            }
        }
        return this.t.getClass().toString();
    }
Shrink the content to display for both Collection and Map
@return
hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/ObjectWritable.java