Beispiel #1
0
  public static EvictionHint ReadEvcHint(CacheObjectInput reader)
      throws IOException, ClassNotFoundException {
    EvictionHintType expHint = EvictionHintType.Parent;
    expHint = EvictionHintType.forValue(reader.readShort());
    EvictionHint tmpObj = null;
    switch (expHint) {
      case NULL:
        return null;

      case Parent:
        tmpObj = (EvictionHint) reader.readObject();
        return (EvictionHint) tmpObj;

      case CounterHint:
        CounterHint ch = new CounterHint();
        ((ICompactSerializable) ch).deserialize(reader);
        return (EvictionHint) ch;

      case PriorityEvictionHint:
        PriorityEvictionHint peh = new PriorityEvictionHint();
        ((ICompactSerializable) peh).deserialize(reader);
        return (EvictionHint) peh;

      case TimestampHint:
        TimestampHint tsh = new TimestampHint();
        ((ICompactSerializable) tsh).deserialize(reader);
        return (EvictionHint) tsh;

      default:
        break;
    }
    return null;
  }
Beispiel #2
0
  public static void WriteEvcHint(CacheObjectOutput writer, EvictionHint evcHint)
      throws IOException {
    if (evcHint == null) {
      writer.writeShort((short) EvictionHintType.NULL.getValue());
      return;
    }

    writer.writeShort((short) evcHint._hintType.getValue());
    ((ICompactSerializable) evcHint).serialize(writer);
  }