[DISCUSS] Add flag methods to ClusterState enum

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[DISCUSS] Add flag methods to ClusterState enum

antonovsergey93
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
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Add flag methods to ClusterState enum

Pavel Tupitsyn
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 <[hidden email]>
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
>
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Add flag methods to ClusterState enum

Alexei Scherbakov
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 <[hidden email]>:

> 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 <[hidden email]>
> 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
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Add flag methods to ClusterState enum

Alexei Scherbakov
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 <[hidden email]
>:

> 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 <[hidden email]>:
>
>> 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 <[hidden email]
>> >
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Add flag methods to ClusterState enum

antonovsergey93
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 <[hidden email]
>:

> 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 <
> [hidden email]
> >:
>
> > 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 <[hidden email]>:
> >
> >> 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 <
> [hidden email]
> >> >
> >> 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
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Add flag methods to ClusterState enum

antonovsergey93
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 <[hidden email]>:

> 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 <
> [hidden email]>:
>
>> 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 <
>> [hidden email]
>> >:
>>
>> > 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 <[hidden email]>:
>> >
>> >> 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 <
>> [hidden email]
>> >> >
>> >> 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