redhat-italy / hacep

A scalable, highly available, CEP architecture
Apache License 2.0
27 stars 19 forks source link

Better approach to finalisation of drools session... #15

Open ugol opened 8 years ago

ugol commented 8 years ago

...to get rid of finalizers

ugol commented 8 years ago

Possible algorithm:

  1. in the @DataRehashed PRE listener have a collection of primary keys for that node, C1
    1. in the @DataRehashed POST listener have a collection of primary keys for that node, C2

then call dispose on the drool sessions.

Or, get a look at https://raw.githubusercontent.com/anistor/infinispan/master/core/src/main/java/org/infinispan/notifications/cachelistener/event/DataRehashedEvent.java

that contains both the views before and after rehashing.

<+anistor> ugol: both pre and post events contain to the before/after ConsistentHash objects. and method Address ConsistentHash.locatePrimary(Owner key) can be used to detect if a certain key is primary owned by current node <+anistor> ugol: EmbeddedCacheManager.getAddress() gives you your adress, so you can compare with what locatePrimary returns