com.h3c.util.cache

## Class CacheableDataType

- java.lang.Object
- - com.h3c.util.cache.CacheableDataType

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    AlphaNumericName, DataPathId, DnsName, EthernetType, ICMPv4Type, ICMPv6Type, IpAddress, IpDnsPair, IpProtocol, IpRange, MacAddress, MacPrefix, MacRange, PartialSubnet, Subnet, SubnetMask, TcpUdpPort, TcpUdpPortPair, UnsignedId

      public abstract class CacheableDataType
      extends Object
      implements Serializable

  Base class for cacheable data types.

  It maintains a shared reference queue for housekeeping of GC'd data type instances. The concrete subtypes should use this reference queue instance (via the `getRefQ()` method) when setting up their caches.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheableDataType()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static ReferenceQueue<CacheableDataType>` | `getRefQ()` Provides subclasses with access to our reference queue.
    `protected static String` | `keyFromBytes(byte[] bytes)` Creates a unique string key for the given byte array.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CacheableDataType

          public CacheableDataType()

  - ### Method Detail

    - #### getRefQ

          protected static ReferenceQueue<CacheableDataType> getRefQ()

      Provides subclasses with access to our reference queue. Uses lazy initialization to make sure we only create a cleaner (daemon thread) if we really need one.
      Returns:
        the shared reference queue

    - #### keyFromBytes

          protected static String keyFromBytes(byte[] bytes)

      Creates a unique string key for the given byte array.
      Parameters:
        `bytes` - the bytes
      Returns:
        the unique key

Copyright © 2014. All Rights Reserved.