ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Mashenkov <andrey.mashen...@gmail.com>
Subject Re: multiple thread access in segment resolver
Date Tue, 18 Jul 2017 16:44:02 GMT
Hi Luqman,

Please, take a look at internal class GridSegmentationProcessor and where
the only method isValidSegment() called from.
It is called on node start from single thread and then called from one of
discovery thread (SegmentCheckWorker).
Seems, there is no need any sync.

SegmentationResolver is interface to allow user implement custom logic that
should be used by GridSegmentationProcessor.



On Tue, Jul 18, 2017 at 1:18 PM, luqmanahmad <luqmanahmed@gmail.com> wrote:

> Hi all,
>
> Let say we have a segmentation resolver named
> "ApplicationSegmentationResolver" which is checking about the statuses of
> different applications but it needs to be initialised first time. For
> example something like this:
>
> public ApplicationSegmentationResolver implements SegmentationResolver {
>
> Object status;
>
> public boolean isValidSegment() throws IgniteCheckedException {
>
> if (status == null) {
> status = new Object();
> // do some other stuff which needs to be initialised once
> }
>
> }
>
> }
>
> In the above scenario can multiple threads access this segmentation
> resolver
> at the same time and see the status to null ? I am not sure how the
> internals are working for segmentation resolver and is not clear from the
> SegmentationResolver docs either, but if multiple threads can access it at
> the same time is it a good thing to provide some kind of synchronisation ?
> So that other threads can wait while it is being initialised ?
>
> Thanks,
> Luqman
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/multiple-thread-access-in-segment-
> resolver-tp15049.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Best regards,
Andrey V. Mashenkov

Mime
View raw message