Exemplo n.º 1
0
 /**
  * Post 7.1, if changes are made to this method make sure that it is backwards compatible by
  * creating toDataPreXX methods. Also make sure that the callers to this method are backwards
  * compatible by creating toDataPreXX methods for them even if they are not changed. <br>
  * Callers for this method are: <br>
  * SendQueueMessage.toData(DataOutput) <br>
  */
 public void toData(DataOutput out) throws IOException {
   out.writeByte(this.op.ordinal);
   DataSerializer.writeObject(this.cbArg, out);
   if (this.op.isEntry()) {
     DataSerializer.writeObject(this.key, out);
     if (this.op.isUpdate() || this.op.isCreate()) {
       out.writeByte(this.deserializationPolicy);
       if (this.deserializationPolicy != DistributedCacheOperation.DESERIALIZATION_POLICY_EAGER) {
         DataSerializer.writeByteArray(this.value, out);
       } else {
         DataSerializer.writeObject(this.valueObj, out);
       }
     }
   }
 }
Exemplo n.º 2
0
 public static QueuedOperation createFromData(DataInput in)
     throws IOException, ClassNotFoundException {
   Operation op = Operation.fromOrdinal(in.readByte());
   Object key = null;
   byte[] value = null;
   Object valueObj = null;
   byte deserializationPolicy = DistributedCacheOperation.DESERIALIZATION_POLICY_NONE;
   Object cbArg = DataSerializer.readObject(in);
   if (op.isEntry()) {
     key = DataSerializer.readObject(in);
     if (op.isUpdate() || op.isCreate()) {
       deserializationPolicy = in.readByte();
       if (deserializationPolicy == DistributedCacheOperation.DESERIALIZATION_POLICY_EAGER) {
         valueObj = DataSerializer.readObject(in);
       } else {
         value = DataSerializer.readByteArray(in);
       }
     }
   }
   return new QueuedOperation(op, key, value, valueObj, deserializationPolicy, cbArg);
 }