Hi Sathwik,

DeploymentPoller and DeploymentService use putIfAbsent() before calling
lock() and tryLock(). I didn't get " If a thread not holding a lock on the
non-existent key tries to introduce the key while a lock exists on the
non-existent key,". As always it checks for putIfAbsent() how does a lock
exists on the non-existent key? As in the documentation putIfAbsent() has
same functionality as

if (!map.containsKey(key))
       return map.put(key, value);
   else
       return map.get(key);



On 23 June 2015 at 13:12, Sathwik B P <sathwik...@gmail.com> wrote:

> Sudharma,
>
> 1) At what point is DeploymentPoller blocking? Can you enable debug logs on
> hazelcast and watch.
>
> As per the documentation,
>
> http://docs.hazelcast.org/docs/latest/javadoc/com/hazelcast/core/IMap.html#lock%28K%29
>
> "You get a lock whether the value is present in the map or not. Other
> threads (possibly on other systems) would block on their invoke of lock()
> until the non-existent key is unlocked. If the lock holder introduces the
> key to the map, the put() operation is not blocked. If a thread not holding
> a lock on the non-existent key tries to introduce the key while a lock
> exists on the non-existent key, the put() operation blocks until it is
> unlocked. "
>
> If indeed the scenario after your investigation is same as per the
> documentation, then in DeploymentPoller first go for the tryLock and if
> lock is true and then use putIfAbsent.
>
> 2) If there are issues with 3.5, revert back to earlier version.
>
> regards,
> sathwik
>
> On Tue, Jun 23, 2015 at 10:14 AM, sudharma subasinghe <
> suba...@cse.mrt.ac.lk
> > wrote:
>
> > Hi Sathwik,
> >
> > I modified the code and tested it with two nodes cluster. Deploying and
> > undeploying processes works fine except few things.
> >
> > 1 ) Some times the poller is stuck due to the lock.
> >
> > 2 ) After using hazelcast 3.5 it does not take existing hazelcast.xml
> >
> > Can you help me to solve these things.
> >
> > Thank you.
> >
>

Reply via email to