Hi,

+1 to Val.

Actually if you have different class names on different machines (DataEntity, ServiceEntity) I don't realize how you can get to the checksum validation stage.
In my understanding you should have caught ClassNotFoundException.

Provide me with a full runnable example, I'll run and see what you're trying to implement and at which point you fail.

--
Denis

On 11/10/2015 9:30 AM, Valentin Kulichenko wrote:
Hi,

I'm against optional checksum verification. It's not safe, adds one more
configuration property and I don't see any use case that can require this.

I also don't completely understand what you're trying to achieve. Can you
please describe the sequence of serialization/deserialization events that
you expect in your application?

-Val

On Mon, Nov 9, 2015 at 5:13 PM, 姜 为 <ydswcy...@gmail.com> wrote:

Hi:

         The implementations name maybe not same.

         Like my example:

         class DataEntity {
                 Integer id;
                 string name;
                 Integer age;

                 ….. and other

                 Externalizable.read(in){
                         if(in.readBoolean()) {
                 id = in.readInt();
             }
                         same as name,age...
                 }

         Externalizable.write(out){
             out.writeBoolean(id != null);
             if(id != null) {
                 out.writeInt(id);
             }
             same as name,age...
         }
         }

         class ServiceEntity {
                 Integer id;
                 Integer age;

                 …. and other

                 Externalizable.read(in){
                         if(in.readBoolean()) {
                 id = in.readInt();
             }
             if(in.readBoolean()) {
                 in.readString(); // ignore name
             }
             if(in.readBoolean()) {
                 age = in.readInt();
             }
                         … and other
                 }

         Externalizable.write(out){
             out.writeBoolean(id != null);
             if(id != null) {
                 out.writeInt(id);
             }
             out.writeBoolean(false); // null for name
                        out.writeBoolean(age != null);
             if(age != null) {
                 out.writeInt(age);
             }
                     … and other
         }
         }

         The other implementation class can be serialized and deserialized
custom rules by Externalizable.read and Externalizable.write.
         Each of the different types of servers property needs are
different,it does not require a complete serialization.




在 2015年11月9日,下午10:22,Denis Magda <dma...@gridgain.com> 写道:

Hi,

As I understand both servers have different implementations but the
names of those implementations are the same, correct?
Because otherwise I don't see how your code could get to the point of
checksum validation if one implementation's name is ServiceEntity while the
other's is DataEntity.
If my assumptions above are correct then I would recommend to do the
following:
1) Extend Serializable instead of Externalizable

interface Entity extends Serializable {
     .....
}

2) Add custom serialVersionUID to each implementation. This will help
you get rid off checksum related exception
class EntityImpl implements Entity {
private static final long serialVersionUID = 0L;
......
}


Regards,
Denis

On 11/8/2015 3:27 PM, 姜 为 wrote:
Hi guys:

      I’m using ignite 1.4.
      In IgniteCompute.call will transfer of an object to the cluster.
     The object should implement Serializable or Externalizable
interface.
     OptimizedClassDescriptor.read method will check whether the object
is in the same class.
     In my use case,I have some type of servers in cluster.
     The server type A will check the business,and the server type B
will persistent data.
     There is a entity interface Entity extends Externalizable have
different implementations on different servers.
     Such like this:

     interface Entity extends Externalizable {
      method a();
      method b();
              method c();
      }

      class  ServiceEntity implements Entity {
      method a(){
              // do something...
      }

      method b(){
              // do something...
      }

      method c(){
              throw new UnsupportedException...
      }

      Externalizable.read...
      Externalizable.write...
     }

     class DataEntity implements Entity {
      method a(){
              // do something...
      }

      method b(){
              throw new UnsupportedException...
      }

      method c(){
              // do something...
      }

      Externalizable.read...
      Externalizable.write...
     }


     And IgniteCompute.call(new IgniteCallable(
              public Object call(){
                      Entity.a() or b and c;..
              }
      ));

    Different implementations of the same class are to achieve read and
write methods.
    But OptimizedClassDescriptor.read will check the class sum and throw
ClassNotFoundException.
    I recommend verifyChecksum object set as optional,and I really need
is change.
    Here is my pr:
    https://issues.apache.org/jira/browse/IGNITE-1854 <
https://issues.apache.org/jira/browse/IGNITE-1854> <
https://issues.apache.org/jira/browse/IGNITE-1854> <
https://issues.apache.org/jira/browse/IGNITE-1854>
       https://github.com/apache/ignite/pull/200/ <
https://github.com/apache/ignite/pull/200/> <
https://github.com/apache/ignite/pull/200/> <
https://github.com/apache/ignite/pull/200/>



Reply via email to