commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: StopWatch stop
Date Tue, 02 May 2017 23:22:50 GMT
Here is my version based on a fluent version of Apache Commons Lang's
StopWatch:

https://pastebin.com/biNfwu7S

Example:

try (final StopWatchLogger watch = StopWatchLogger.start(LOGGER,
Level.DEBUG, "Executing {} {}", connectingIOReactor, "foo")) {
  connectingIOReactor.execute(connectingEventDispatch);
}

Logs:
"Executing 1@connectingIOReactor FOO"
"[Executing 1@connectingIOReactor FOO] took 00:00:01.224"

Thoughts?

Gary


On Mon, May 1, 2017 at 7:42 PM, Gary Gregory <garydgregory@gmail.com> wrote:

> Great idea!
>
> Gary
>
> On Mon, May 1, 2017 at 7:36 PM, Matt Sicker <boards@gmail.com> wrote:
>
>> What about a fluent package for classes like this so you can still call it
>> StopWatch?
>>
>> On 1 May 2017 at 21:02, Gary Gregory <garydgregory@gmail.com> wrote:
>>
>> > I am down to copying StopWatch as FluentStopWatch and adding "return
>> this;"
>> > to all the void methods.
>> >
>> > I can so that in my code base but does it induce vomiting if Commons
>> Lang
>> > has both StopWatch AND FluentStopWatch?
>> >
>> > Gary
>> >
>> > On Sun, Apr 30, 2017 at 2:47 PM, Gary Gregory <garydgregory@gmail.com>
>> > wrote:
>> >
>> > > Sorry, Commons Lang.
>> > >
>> > > Gary
>> > >
>> > > On Apr 30, 2017 1:47 PM, "Matt Sicker" <boards@gmail.com> wrote:
>> > >
>> > >> Which subproject are you speaking of anyways?
>> > >>
>> > >> On 30 April 2017 at 15:46, Gary Gregory <garydgregory@gmail.com>
>> wrote:
>> > >>
>> > >> > A new method perhaps or a new class a la fluent?
>> > >> >
>> > >> > Gary
>> > >> >
>> > >> > On Apr 30, 2017 1:32 PM, "Matt Sicker" <boards@gmail.com>
wrote:
>> > >> >
>> > >> > > Yup, here it is:
>> > >> > > 13.4.15. Method Result Type
>> > >> > >
>> > >> > > Changing the result type of a method, or replacing a result
type
>> > with
>> > >> > void,
>> > >> > > or replacing void with a result type, has the combined effect
of
>> > >> deleting
>> > >> > > the old method and adding a new method with the new result
type
>> or
>> > >> newly
>> > >> > > void result (see §13.4.12
>> > >> > > <https://docs.oracle.com/javase/specs/jls/se7/html/jls-
>> > >> > 13.html#jls-13.4.12
>> > >> > > >
>> > >> > > ).
>> > >> > >
>> > >> > > For purposes of binary compatibility, adding or removing
a
>> method or
>> > >> > > constructor m whose return type involves type variables (§4.4
>> > >> > > <https://docs.oracle.com/javase/specs/jls/se7/html/jls-
>> > 4.html#jls-4.4
>> > >> >)
>> > >> > or
>> > >> > > parameterized types (§4.5
>> > >> > > <https://docs.oracle.com/javase/specs/jls/se7/html/jls-
>> > 4.html#jls-4.5
>> > >> >)
>> > >> > is
>> > >> > > equivalent to the addition (respectively, removal) of the
an
>> > otherwise
>> > >> > > equivalent method whose return type is the erasure (§4.6
>> > >> > > <https://docs.oracle.com/javase/specs/jls/se7/html/jls-
>> > 4.html#jls-4.6
>> > >> >)
>> > >> > of
>> > >> > > the return type of m.
>> > >> > >
>> > >> > > On 30 April 2017 at 15:30, Matt Sicker <boards@gmail.com>
wrote:
>> > >> > >
>> > >> > > > https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html
>> > >> > > >
>> > >> > > > A reference to a method must be resolved at compile
time to a
>> > >> symbolic
>> > >> > > > reference to the erasure (§4.6
>> > >> > > > <https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.
>> > >> html#jls-4.6
>> > >> > >)
>> > >> > > > of the qualifying type of the invocation, plus the erasure
of
>> the
>> > >> > > signature
>> > >> > > > (§8.4.2
>> > >> > > > <https://docs.oracle.com/javase/specs/jls/se7/html/jls-
>> > >> > 8.html#jls-8.4.2
>> > >> > > >)
>> > >> > > > of the method.
>> > >> > > >
>> > >> > > > I'm getting the impression here that the ABI follows
the same
>> > rules
>> > >> as
>> > >> > > > using MethodHandle.invokeExact().
>> > >> > > >
>> > >> > > > On 30 April 2017 at 15:21, Gary Gregory <
>> garydgregory@gmail.com>
>> > >> > wrote:
>> > >> > > >
>> > >> > > >> On Apr 30, 2017 1:19 PM, "Oliver Heger" <
>> > >> oliver.heger@oliver-heger.de
>> > >> > >
>> > >> > > >> wrote:
>> > >> > > >>
>> > >> > > >> I think client code has to be recompiled, otherwise
a
>> > >> > NoSuchMethodError
>> > >> > > >> is thrown.
>> > >> > > >>
>> > >> > > >>
>> > >> > > >>
>> > >> > > >> Dang it. Are you sure?
>> > >> > > >>
>> > >> > > >> Gary
>> > >> > > >>
>> > >> > > >>
>> > >> > > >> Oliver
>> > >> > > >>
>> > >> > > >> Am 30.04.2017 um 21:24 schrieb Matt Sicker:
>> > >> > > >> > That sort of thing changes the binary signature,
but source
>> > >> > > >> compatibility
>> > >> > > >> > is retained.
>> > >> > > >> >
>> > >> > > >> > On 30 April 2017 at 14:20, Gary Gregory <
>> > garydgregory@gmail.com>
>> > >> > > wrote:
>> > >> > > >> >
>> > >> > > >> >> Hi,
>> > >> > > >> >>
>> > >> > > >> >> Would it break BC to change StopWatch.stop()
to return
>> "this"?
>> > >> > > >> >>
>> > >> > > >> >> Gary
>> > >> > > >> >>
>> > >> > > >> >> --
>> > >> > > >> >> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> > >> > > >> >> Java Persistence with Hibernate, Second
Edition
>> > >> > > >> >> <https://www.amazon.com/gp/product/1617290459/ref=as_li_
>> > >> > > >> >> tl?ie=UTF8&camp=1789&creative=
>> 9325&creativeASIN=1617290459&
>> > >> > > >> >> linkCode=as2&tag=garygregory-2
>> 0&linkId=cadb800f39946ec62ea2b
>> > >> > > >> 1af9fe6a2b8>
>> > >> > > >> >>
>> > >> > > >> >> <http:////ir-na.amazon-adsystem.com/e/ir?t=
>> > >> > > garygregory-20&l=am2&o=1&a=
>> > >> > > >> >> 1617290459>
>> > >> > > >> >> JUnit in Action, Second Edition
>> > >> > > >> >> <https://www.amazon.com/gp/product/1935182021/ref=as_li_
>> > >> > > >> >> tl?ie=UTF8&camp=1789&creative=
>> 9325&creativeASIN=1935182021&
>> > >> > > >> >> linkCode=as2&tag=garygregory-20&linkId=
>> > >> > > 31ecd1f6b6d1eaf8886ac902a24de4
>> > >> > > >> 18%22
>> > >> > > >> >>>
>> > >> > > >> >>
>> > >> > > >> >> <http:////ir-na.amazon-adsystem.com/e/ir?t=
>> > >> > > garygregory-20&l=am2&o=1&a=
>> > >> > > >> >> 1935182021>
>> > >> > > >> >> Spring Batch in Action
>> > >> > > >> >> <https://www.amazon.com/gp/product/1935182951/ref=as_li_
>> > >> > > >> >> tl?ie=UTF8&camp=1789&creative=
>> 9325&creativeASIN=1935182951&
>> > >> > > >> >> linkCode=%7B%7BlinkCode%7D%7D&
>> tag=garygregory-20&linkId=%7B%
>> > >> > > >> >> 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>> > >> > > >> >> <http:////ir-na.amazon-adsystem.com/e/ir?t=
>> > >> > > garygregory-20&l=am2&o=1&a=
>> > >> > > >> >> 1935182951>
>> > >> > > >> >> Blog: http://garygregory.wordpress.com
>> > >> > > >> >> Home: http://garygregory.com/
>> > >> > > >> >> Tweet! http://twitter.com/GaryGregory
>> > >> > > >> >>
>> > >> > > >> >
>> > >> > > >> >
>> > >> > > >> >
>> > >> > > >>
>> > >> > > >> ------------------------------------------------------------
>> > >> ---------
>> > >> > > >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> > >> > > >> For additional commands, e-mail: dev-help@commons.apache.org
>> > >> > > >>
>> > >> > > >
>> > >> > > >
>> > >> > > >
>> > >> > > > --
>> > >> > > > Matt Sicker <boards@gmail.com>
>> > >> > > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > > --
>> > >> > > Matt Sicker <boards@gmail.com>
>> > >> > >
>> > >> >
>> > >>
>> > >>
>> > >>
>> > >> --
>> > >> Matt Sicker <boards@gmail.com>
>> > >>
>> > >
>> >
>> >
>> > --
>> > E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> > Java Persistence with Hibernate, Second Edition
>> > <https://www.amazon.com/gp/product/1617290459/ref=as_li_
>> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&
>> > linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b
>> 1af9fe6a2b8>
>> >
>> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
>> > 1617290459>
>> > JUnit in Action, Second Edition
>> > <https://www.amazon.com/gp/product/1935182021/ref=as_li_
>> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&
>> > linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac
>> 902a24de418%22
>> > >
>> >
>> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
>> > 1935182021>
>> > Spring Batch in Action
>> > <https://www.amazon.com/gp/product/1935182951/ref=as_li_
>> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&
>> > linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%
>> > 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
>> > 1935182951>
>> > Blog: http://garygregory.wordpress.com
>> > Home: http://garygregory.com/
>> > Tweet! http://twitter.com/GaryGregory
>> >
>>
>>
>>
>> --
>> Matt Sicker <boards@gmail.com>
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
>
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
> JUnit in Action, Second Edition
> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
>
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
> Spring Batch in Action
> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message