--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/p7WDN7jOBvUJ.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.
To unsubscribe from this group, send email to hazelcast+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/WznQ7sjJBwoJ.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/WceKIXn61sAJ.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+unsubscribe@googlegroups.com.
However, I think you missed the point on my examples. And the requirement you speak of IS met. I don't see how you can say it is not. Take my example posted earlier and add generic params: MultiMap<Integer, Number> ... It will work the same and the generics contract is fulfilled.
In my previous example the call to remove(k,v) should return false because it is NOT equal. It just happens that its serialized byte form IS equal which is why remove(k,v) returns true when its done within a transaction --- (note: when the transaction is committed it doesn't actually remove the element even though it previously said it would).
My point is that MultiMap functions differently depending on if remove(k,v) is called within a transaction or not. If its called within a transaction it compares the identity of v in its serialized form.
If the Hazelcast devs want value comparisons to be done with equals & hashCode... that's fine... but it needs to be consistent and I think I have shown that it is not. I would still maintain that you could achieve higher performance if you did not use equals & hashCode to do the value comparisons.
--
The serialized form of Long appears to be equal to the serialized form of Integer for the same number for the purposes of MultiMap.remove(k,v) within a transaction. (2 vs 2L) Please run my example code. I am not trying to have a philosophical discussion on serialization. I just want to point out a bug I found. If you think its not a bug, please feel free to post some code and I will happily run it.
--
I don't think there are any values for Foo and Bar that make sense. I don't accept the form of your example: Attempts to remove something using a different type aren't guaranteed to work.
--
I think you guys might have to really point out the exact sentence in the docs that says this. I am just not seeing it :-(.It doesn't say hashCode and equals are required there for the value. Plus, if this is how it is intended to work, why does containsValue compare the serialized form of the value? There is a bug here. Maybe it's a documentation + consistency thing.
On another note, I would not expect the implementation of remove(k,v) to iterate over every single value in k. I would expect that to be optimized in hazelcast to be O(1) and I don't think this is an unreasonable assumption for this to be the implementation. For example, it would send a message to the owner of k to remove v. The owner of k would then complete this in O(1) using HashSet.remove(v). (this was my assumption)
I had assumed that Hazelcast was trying to be as fast as possible, opting to store data (keys and values) in its serialized form so it's fast to send keys/values over the wire without having to serialize all the time. I assumed that any comparison request that came over the wire would then compare the serialized forms so it did not have to incur the cost of n deserializations. This makes the most sense to me from a performance perspective.
public class MultimapBug {
public static void main(String[] args) {
Config config = new Config();
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
MultiMap<Integer, Order> multiMap = instance.getMultiMap("blah");
multiMap.put(1, new Order(1, "foo"));
multiMap.put(1, new Order(2, "bar"));
multiMap.put(1, new Order(3, "zoo"));
multiMap.put(2, new Order(4, "foo"));
multiMap.put(2, new Order(5, "bar"));
multiMap.put(2, new Order(6, "zoo"));
Collection<Order> items = multiMap.get(1);
for (Order o : items) {
System.out.println(multiMap.remove(1, o));
}
System.out.println("Size: " + multiMap.size());
}
public static class Order implements Serializable {
private static final long serialVersionUID = 1L;
private int id;
private Set<String> set;
public Order(int id, String s) {
this.id = id;
set = new HashSet<String>();
set.add(s);
}
}
}
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/b66df3f6-c695-4648-83a2-48bd3e4eed3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
