~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/main/java/net/sf/ehcache/pool/sizeof/ObjectGraphWalker.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 *  Copyright 2003-2010 Terracotta, Inc.
 
2
 *  Copyright Terracotta, Inc.
3
3
 *
4
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
5
 *  you may not use this file except in compliance with the License.
151
151
                }
152
152
 
153
153
                Class<?> refClass = ref.getClass();
154
 
                if (shouldWalkClass(refClass)) {
 
154
                if (!isSharedFlyweight(ref) && shouldWalkClass(refClass)) {
155
155
                    if (refClass.isArray() && !refClass.getComponentType().isPrimitive()) {
156
156
                        for (int i = 0; i < Array.getLength(ref); i++) {
157
157
                            nullSafeAdd(toVisit, Array.get(ref, i));
280
280
        }
281
281
        return fields;
282
282
    }
 
283
 
 
284
    private static boolean isSharedFlyweight(Object obj) {
 
285
        FlyweightType type = FlyweightType.getFlyweightType(obj.getClass());
 
286
        return type != null && type.isShared(obj);
 
287
    }
 
288
 
283
289
}