Aren't the classes in datetime copied from commons? Might be simpler to
keep that package uncluttered for easier updates.

Also, I like the name ConstantClock or something like that. Constant is a
nice term with appropriate mathematical connotations.

On 24 January 2018 at 12:00, Gary Gregory <garydgreg...@gmail.com> wrote:

> On Wed, Jan 24, 2018 at 10:55 AM, Gary Gregory <garydgreg...@gmail.com>
> wrote:
>
> >
> >
> > On Wed, Jan 24, 2018 at 8:58 AM, Remko Popma <remko.po...@gmail.com>
> > wrote:
> >
> >> I see what you mean. Hmm...
> >>
> >> FYI, this feature (LOG4J2-1883) adds the following classes. I added them
> >> to
> >> core.util, but they could still be moved to another package:
> >> * Instant <interface>
> >> * PreciseClock <interface>
> >> * MutableInstant
> >> * DummyPreciseClock
> >>
> >
> Hi,
>
> I urge you _not_ to name this class Dummy*, that tells me nothing :-(
>
> OTOH, the Javadoc states:
>
> /**
> * Implementation of the {@code PreciseClock} interface that always returns
> a fixed value.
> * @since 2.11
> */
>
>
> public class DummyPreciseClock implements PreciseClock {
>
> So I would call this class StaticPreciseClock (or FixedValuePreciseClock,
> or ConstantPreciseClock)
>
> ah... better :-)
>
> Gary
>
>
>
> > * SystemMillisClock
> >>
> >> I would not consider moving the existing time-related classes, because
> >> that
> >> would break client code. These should stay as is:
> >> * Clock <interface>
> >> * NanoClock <interface>
> >> * ClockFactory
> >> * SystemNanoClock, DummyNanoClock
> >> * CachedClock, CoarseCachedClock, SystemClock
> >>
> >> I also would not want to rename core.util.datetime; that would just
> break
> >> client code without any tangible benefit.
> >>
> >> So, we can add the new 5 classes to core.util.datetime, or create a new
> >> package core.util.time and add them there, or leave them in core.util.
> >> Not
> >> sure which I prefer actually, need to think about it a bit...
> >>
> >
> > For me the right place is core.time. Anything in or under "util" is not
> > nice IMO. In Java 8 we have java.time, not java.util.time, so core.time
> > feels right (and modern.)
> >
> > Gary
> >
> >>
> >>
> >>
> >> On Wed, Jan 24, 2018 at 11:54 PM, Gary Gregory <garydgreg...@gmail.com>
> >> wrote:
> >>
> >> > Hi,
> >> >
> >> > The package core.time is starting to look like a kitchen sink. Why not
> >> put
> >> > this new class into the existing core.util.datetime or into a new
> >> core.time
> >> > package. IMO core.util.datetime, should be core.datetime or simply
> >> > core.util.time.
> >> >
> >> > Gary
> >> >
> >> > On Wed, Jan 24, 2018 at 4:22 AM, <rpo...@apache.org> wrote:
> >> >
> >> > > Repository: logging-log4j2
> >> > > Updated Branches:
> >> > >   refs/heads/LOG4J2-1883-instant-field 3c22d3d83 -> b8b519e5b
> >> > >
> >> > >
> >> > > LOG4J2-1883 moved SystemMillisClock out of the java9 module into
> core
> >> so
> >> > > it can be used with any supported Java version
> >> > >
> >> > >
> >> > > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> >> > > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> >> > > commit/b8b519e5
> >> > > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> >> > b8b519e5
> >> > > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> >> > b8b519e5
> >> > >
> >> > > Branch: refs/heads/LOG4J2-1883-instant-field
> >> > > Commit: b8b519e5b6125ca08545691a631e8b3e0a0e4cd0
> >> > > Parents: 3c22d3d
> >> > > Author: rpopma <rpo...@apache.org>
> >> > > Authored: Wed Jan 24 20:22:41 2018 +0900
> >> > > Committer: rpopma <rpo...@apache.org>
> >> > > Committed: Wed Jan 24 20:22:41 2018 +0900
> >> > >
> >> > > ------------------------------------------------------------
> >> ----------
> >> > >  .../log4j/core/util/SystemMillisClock.java      | 34
> >> > --------------------
> >> > >  .../log4j/core/util/SystemMillisClock.java      | 34
> >> > ++++++++++++++++++++
> >> > >  2 files changed, 34 insertions(+), 34 deletions(-)
> >> > > ------------------------------------------------------------
> >> ----------
> >> > >
> >> > >
> >> > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> >> > > b8b519e5/log4j-core-java9/src/main/java/org/apache/logging/
> >> > > log4j/core/util/SystemMillisClock.java
> >> > > ------------------------------------------------------------
> >> ----------
> >> > > diff --git a/log4j-core-java9/src/main/
> java/org/apache/logging/log4j/
> >> > > core/util/SystemMillisClock.java b/log4j-core-java9/src/main/
> >> > > java/org/apache/logging/log4j/core/util/SystemMillisClock.java
> >> > > deleted file mode 100644
> >> > > index f267320..0000000
> >> > > --- a/log4j-core-java9/src/main/java/org/apache/logging/log4j/
> >> > > core/util/SystemMillisClock.java
> >> > > +++ /dev/null
> >> > > @@ -1,34 +0,0 @@
> >> > > -/*
> >> > > - * Licensed to the Apache Software Foundation (ASF) under one or
> more
> >> > > - * contributor license agreements. See the NOTICE file distributed
> >> with
> >> > > - * this work for additional information regarding copyright
> >> ownership.
> >> > > - * The ASF licenses this file to You under the Apache license,
> >> Version
> >> > 2.0
> >> > > - * (the "License"); you may not use this file except in compliance
> >> with
> >> > > - * the License. You may obtain a copy of the License at
> >> > > - *
> >> > > - *      http://www.apache.org/licenses/LICENSE-2.0
> >> > > - *
> >> > > - * Unless required by applicable law or agreed to in writing,
> >> software
> >> > > - * distributed under the License is distributed on an "AS IS"
> BASIS,
> >> > > - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >> > > implied.
> >> > > - * See the license for the specific language governing permissions
> >> and
> >> > > - * limitations under the license.
> >> > > - */
> >> > > -package org.apache.logging.log4j.core.util;
> >> > > -
> >> > > -/**
> >> > > - * Implementation of the {@code Clock} interface that returns the
> >> system
> >> > > time in millisecond granularity.
> >> > > - * @since 2.11
> >> > > - */
> >> > > -public final class SystemMillisClock implements Clock {
> >> > > -
> >> > > -    /**
> >> > > -     * Returns the system time.
> >> > > -     * @return the result of calling {@code
> >> System.currentTimeMillis()}
> >> > > -     */
> >> > > -    @Override
> >> > > -    public long currentTimeMillis() {
> >> > > -        return System.currentTimeMillis();
> >> > > -    }
> >> > > -
> >> > > -}
> >> > >
> >> > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> >> > > b8b519e5/log4j-core/src/main/java/org/apache/logging/log4j/
> >> > > core/util/SystemMillisClock.java
> >> > > ------------------------------------------------------------
> >> ----------
> >> > > diff --git a/log4j-core/src/main/java/
> org/apache/logging/log4j/core/
> >> > util/SystemMillisClock.java
> >> > > b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> >> > > util/SystemMillisClock.java
> >> > > new file mode 100644
> >> > > index 0000000..f267320
> >> > > --- /dev/null
> >> > > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> >> > > util/SystemMillisClock.java
> >> > > @@ -0,0 +1,34 @@
> >> > > +/*
> >> > > + * Licensed to the Apache Software Foundation (ASF) under one or
> more
> >> > > + * contributor license agreements. See the NOTICE file distributed
> >> with
> >> > > + * this work for additional information regarding copyright
> >> ownership.
> >> > > + * The ASF licenses this file to You under the Apache license,
> >> Version
> >> > 2.0
> >> > > + * (the "License"); you may not use this file except in compliance
> >> with
> >> > > + * the License. You may obtain a copy of the License at
> >> > > + *
> >> > > + *      http://www.apache.org/licenses/LICENSE-2.0
> >> > > + *
> >> > > + * Unless required by applicable law or agreed to in writing,
> >> software
> >> > > + * distributed under the License is distributed on an "AS IS"
> BASIS,
> >> > > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >> > > implied.
> >> > > + * See the license for the specific language governing permissions
> >> and
> >> > > + * limitations under the license.
> >> > > + */
> >> > > +package org.apache.logging.log4j.core.util;
> >> > > +
> >> > > +/**
> >> > > + * Implementation of the {@code Clock} interface that returns the
> >> system
> >> > > time in millisecond granularity.
> >> > > + * @since 2.11
> >> > > + */
> >> > > +public final class SystemMillisClock implements Clock {
> >> > > +
> >> > > +    /**
> >> > > +     * Returns the system time.
> >> > > +     * @return the result of calling {@code
> >> System.currentTimeMillis()}
> >> > > +     */
> >> > > +    @Override
> >> > > +    public long currentTimeMillis() {
> >> > > +        return System.currentTimeMillis();
> >> > > +    }
> >> > > +
> >> > > +}
> >> > >
> >> > >
> >> >
> >>
> >
> >
>



-- 
Matt Sicker <boa...@gmail.com>

Reply via email to