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;
  }
 /**
  * Read and return an object. The class that implements this interface defines where the object is
  * "read" from.
  *
  * @param input the stream to read data from in order to restore the object.
  * @return the object read from the stream
  * @exception java.lang.ClassNotFoundException If the class of a serialized object cannot be
  *     found.
  * @throws CacheIOException If any of the usual Input/Output related exceptions occur.
  */
 public Object readObject(CacheObjectInput input)
     throws CacheInstantiationException, CacheIOException {
   BlockDataInputStream bin = (BlockDataInputStream) input.getContext().getUserItem("__bin");
   try {
     if (bin != null) {
       return bin.readUTF();
     } else {
       return input.readUTF();
     }
   } catch (IOException ex) {
     throw new CacheIOException(ex);
   }
 }
 public void skipObject(CacheObjectInput input)
     throws CacheInstantiationException, CacheIOException {
   try {
     input.skipUTF();
   } catch (IOException ex) {
     throw new CacheIOException(ex);
   }
 }
Beispiel #4
0
 public void deserialize(CacheObjectInput reader) throws ClassNotFoundException, IOException {
   super.deserialize(reader);
   _count = reader.readShort();
 }
Beispiel #5
0
 @Override
 public void deserialize(CacheObjectInput reader) throws ClassNotFoundException, IOException {
   _hintType = EvictionHintType.forValue(reader.readShort());
 }