You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Sergey Antonov <an...@gmail.com> on 2020/06/10 15:58:18 UTC

[DISCUSS] Add flag methods to ClusterState enum

Igniters, I'd like to propose a small improvement in ClusterState class. I
want to remove the static method boolean ClusterState#active and add
methods to the enum:

   - boolean active()
   - boolean readOnly()
   - boolean inactive()

From my point of view these methods more useful than comparing with
specific enum's value.

I'm going to do that on the ticket [1].

Any objections?

[1] https://issues.apache.org/jira/browse/IGNITE-13144
-- 
BR, Sergey Antonov

Re: [DISCUSS] Add flag methods to ClusterState enum

Posted by Sergey Antonov <an...@gmail.com>.
Igniters, the patch [1] is ready for the review.

Can someone look at it, please?

[1] https://github.com/apache/ignite/pull/7924

ср, 10 июн. 2020 г. в 23:42, Sergey Antonov <an...@gmail.com>:

> Pavel, Alexei thank you for your replays.
>
> > is this one special in some way?
> Yes. We have two "active" cluster states: ACTIVE, ACTIVE_READ_ONLY.
> Probably, I chose the wrong method's name, but I mean that in "active"
> state the caches must be started.
>
> > But it looks like we do not need methods *readOnly *and *inactive*.
> I agree.
>
> ср, 10 июн. 2020 г. в 21:17, Alexei Scherbakov <
> alexey.scherbakoff@gmail.com>:
>
>> But it looks like we do not need methods *readOnly *and *inactive*.
>> What is the point in adding them ?
>>
>>
>> ср, 10 июн. 2020 г. в 21:05, Alexei Scherbakov <
>> alexey.scherbakoff@gmail.com
>> >:
>>
>> > Sergey Antonov,
>> >
>> > The proposal looks good to me.
>> > Use of org.apache.ignite.cluster.ClusterState#active adds a
>> > boilerplate code (a lot of static imports) and does an unnecessary state
>> > check.
>> >
>> >
>> >
>> >
>> > ср, 10 июн. 2020 г. в 19:02, Pavel Tupitsyn <pt...@apache.org>:
>> >
>> >> Sergey,
>> >>
>> >> I disagree - looks weird.
>> >> We have lots of enums, is this one special in some way?
>> >>
>> >> Thanks,
>> >> Pavel
>> >>
>> >> On Wed, Jun 10, 2020 at 6:58 PM Sergey Antonov <
>> antonovsergey93@gmail.com
>> >> >
>> >> wrote:
>> >>
>> >> > Igniters, I'd like to propose a small improvement in ClusterState
>> >> class. I
>> >> > want to remove the static method boolean ClusterState#active and add
>> >> > methods to the enum:
>> >> >
>> >> >    - boolean active()
>> >> >    - boolean readOnly()
>> >> >    - boolean inactive()
>> >> >
>> >> > From my point of view these methods more useful than comparing with
>> >> > specific enum's value.
>> >> >
>> >> > I'm going to do that on the ticket [1].
>> >> >
>> >> > Any objections?
>> >> >
>> >> > [1] https://issues.apache.org/jira/browse/IGNITE-13144
>> >> > --
>> >> > BR, Sergey Antonov
>> >> >
>> >>
>> >
>> >
>> > --
>> >
>> > Best regards,
>> > Alexei Scherbakov
>> >
>>
>>
>> --
>>
>> Best regards,
>> Alexei Scherbakov
>>
>
>
> --
> BR, Sergey Antonov
>


-- 
BR, Sergey Antonov

Re: [DISCUSS] Add flag methods to ClusterState enum

Posted by Sergey Antonov <an...@gmail.com>.
Pavel, Alexei thank you for your replays.

> is this one special in some way?
Yes. We have two "active" cluster states: ACTIVE, ACTIVE_READ_ONLY.
Probably, I chose the wrong method's name, but I mean that in "active"
state the caches must be started.

> But it looks like we do not need methods *readOnly *and *inactive*.
I agree.

ср, 10 июн. 2020 г. в 21:17, Alexei Scherbakov <alexey.scherbakoff@gmail.com
>:

> But it looks like we do not need methods *readOnly *and *inactive*.
> What is the point in adding them ?
>
>
> ср, 10 июн. 2020 г. в 21:05, Alexei Scherbakov <
> alexey.scherbakoff@gmail.com
> >:
>
> > Sergey Antonov,
> >
> > The proposal looks good to me.
> > Use of org.apache.ignite.cluster.ClusterState#active adds a
> > boilerplate code (a lot of static imports) and does an unnecessary state
> > check.
> >
> >
> >
> >
> > ср, 10 июн. 2020 г. в 19:02, Pavel Tupitsyn <pt...@apache.org>:
> >
> >> Sergey,
> >>
> >> I disagree - looks weird.
> >> We have lots of enums, is this one special in some way?
> >>
> >> Thanks,
> >> Pavel
> >>
> >> On Wed, Jun 10, 2020 at 6:58 PM Sergey Antonov <
> antonovsergey93@gmail.com
> >> >
> >> wrote:
> >>
> >> > Igniters, I'd like to propose a small improvement in ClusterState
> >> class. I
> >> > want to remove the static method boolean ClusterState#active and add
> >> > methods to the enum:
> >> >
> >> >    - boolean active()
> >> >    - boolean readOnly()
> >> >    - boolean inactive()
> >> >
> >> > From my point of view these methods more useful than comparing with
> >> > specific enum's value.
> >> >
> >> > I'm going to do that on the ticket [1].
> >> >
> >> > Any objections?
> >> >
> >> > [1] https://issues.apache.org/jira/browse/IGNITE-13144
> >> > --
> >> > BR, Sergey Antonov
> >> >
> >>
> >
> >
> > --
> >
> > Best regards,
> > Alexei Scherbakov
> >
>
>
> --
>
> Best regards,
> Alexei Scherbakov
>


-- 
BR, Sergey Antonov

Re: [DISCUSS] Add flag methods to ClusterState enum

Posted by Alexei Scherbakov <al...@gmail.com>.
But it looks like we do not need methods *readOnly *and *inactive*.
What is the point in adding them ?


ср, 10 июн. 2020 г. в 21:05, Alexei Scherbakov <alexey.scherbakoff@gmail.com
>:

> Sergey Antonov,
>
> The proposal looks good to me.
> Use of org.apache.ignite.cluster.ClusterState#active adds a
> boilerplate code (a lot of static imports) and does an unnecessary state
> check.
>
>
>
>
> ср, 10 июн. 2020 г. в 19:02, Pavel Tupitsyn <pt...@apache.org>:
>
>> Sergey,
>>
>> I disagree - looks weird.
>> We have lots of enums, is this one special in some way?
>>
>> Thanks,
>> Pavel
>>
>> On Wed, Jun 10, 2020 at 6:58 PM Sergey Antonov <antonovsergey93@gmail.com
>> >
>> wrote:
>>
>> > Igniters, I'd like to propose a small improvement in ClusterState
>> class. I
>> > want to remove the static method boolean ClusterState#active and add
>> > methods to the enum:
>> >
>> >    - boolean active()
>> >    - boolean readOnly()
>> >    - boolean inactive()
>> >
>> > From my point of view these methods more useful than comparing with
>> > specific enum's value.
>> >
>> > I'm going to do that on the ticket [1].
>> >
>> > Any objections?
>> >
>> > [1] https://issues.apache.org/jira/browse/IGNITE-13144
>> > --
>> > BR, Sergey Antonov
>> >
>>
>
>
> --
>
> Best regards,
> Alexei Scherbakov
>


-- 

Best regards,
Alexei Scherbakov

Re: [DISCUSS] Add flag methods to ClusterState enum

Posted by Alexei Scherbakov <al...@gmail.com>.
Sergey Antonov,

The proposal looks good to me.
Use of org.apache.ignite.cluster.ClusterState#active adds a
boilerplate code (a lot of static imports) and does an unnecessary state
check.




ср, 10 июн. 2020 г. в 19:02, Pavel Tupitsyn <pt...@apache.org>:

> Sergey,
>
> I disagree - looks weird.
> We have lots of enums, is this one special in some way?
>
> Thanks,
> Pavel
>
> On Wed, Jun 10, 2020 at 6:58 PM Sergey Antonov <an...@gmail.com>
> wrote:
>
> > Igniters, I'd like to propose a small improvement in ClusterState class.
> I
> > want to remove the static method boolean ClusterState#active and add
> > methods to the enum:
> >
> >    - boolean active()
> >    - boolean readOnly()
> >    - boolean inactive()
> >
> > From my point of view these methods more useful than comparing with
> > specific enum's value.
> >
> > I'm going to do that on the ticket [1].
> >
> > Any objections?
> >
> > [1] https://issues.apache.org/jira/browse/IGNITE-13144
> > --
> > BR, Sergey Antonov
> >
>


-- 

Best regards,
Alexei Scherbakov

Re: [DISCUSS] Add flag methods to ClusterState enum

Posted by Pavel Tupitsyn <pt...@apache.org>.
Sergey,

I disagree - looks weird.
We have lots of enums, is this one special in some way?

Thanks,
Pavel

On Wed, Jun 10, 2020 at 6:58 PM Sergey Antonov <an...@gmail.com>
wrote:

> Igniters, I'd like to propose a small improvement in ClusterState class. I
> want to remove the static method boolean ClusterState#active and add
> methods to the enum:
>
>    - boolean active()
>    - boolean readOnly()
>    - boolean inactive()
>
> From my point of view these methods more useful than comparing with
> specific enum's value.
>
> I'm going to do that on the ticket [1].
>
> Any objections?
>
> [1] https://issues.apache.org/jira/browse/IGNITE-13144
> --
> BR, Sergey Antonov
>