Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jul 19 20:37
    @SethTisue banned @tonyobanon
  • Jan 02 23:58
    @SethTisue banned @fakubishes:nerdsin.space
  • Dec 15 2021 05:01
    som-snytt commented #12516
  • Dec 15 2021 04:38
    SethTisue edited #1312
  • Dec 15 2021 04:38
    SethTisue opened #2273
  • Dec 15 2021 04:31
    jackkoenig opened #12516
  • Dec 15 2021 04:29
    SethTisue edited #1312
  • Dec 15 2021 04:28
    SethTisue edited #1312
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    scala-jenkins milestoned #9831
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    SethTisue opened #9831
  • Dec 15 2021 03:35
    som-snytt commented #11339
  • Dec 15 2021 03:27
    som-snytt labeled #12494
  • Dec 15 2021 03:07
    SethTisue edited #1312
  • Dec 15 2021 03:07
    SethTisue edited #1312
  • Dec 15 2021 03:05
    SethTisue edited #1312
  • Dec 15 2021 03:05
    SethTisue edited #1312
  • Dec 15 2021 03:05
    SethTisue edited #1312
  • Dec 15 2021 02:58
    SethTisue edited #1312
Martijn Hoekstra
@martijnhoekstra
So the trie holds requests to lock some file or directory. And when a lock is released, you want to find the oldest request waiting for that file to become available
Mark Hammons
@markehammons
yep
so, startTime is useful for that, but the problem is its granularity is ms
in my tests, I can allocate requests much faster than 1 per ms, unless I use Thread.sleep
Martijn Hoekstra
@martijnhoekstra
if that's the issue, just impose an artificial ordering key on it
Mark Hammons
@markehammons
so, my thoughts on that was using a private AtomicLong in the LockRequest companion object, with a method to get the next long and increment
only problem is of course the point which the Long value overflows
Martijn Hoekstra
@martijnhoekstra
do you need to sweat that? There are a lot of Long values
Mark Hammons
@markehammons
in that case, if there were two requests, started at the same ms, in the same node, and one rolled over to negative then technically it would go first
i'm guessing no personally. i think in the case of that particular blue moon, it's ok if ordering is violated just once
the other request will still get served eventually, it'll just have to wait a little longer than it normally would
Martijn Hoekstra
@martijnhoekstra
I suspect it's likelier that your disk wears out before you did your 2.147.483.647 lock requests on it than the other way round
Mark Hammons
@markehammons
well, this is going on a raid system so in theory i could just keep replacing the disks :p
Martijn Hoekstra
@martijnhoekstra
well, back to the drawing board then :P
Mark Hammons
@markehammons
but also, i'd have more like 9,223,372,036,854,775,808 lock requests before overflow is even possibly an issue if I started the counter at 0, but I'm starting at Long.MinValue, so it's more like 1.844674407370955e19
Martijn Hoekstra
@martijnhoekstra
so I think we can call that good :D
Mark Hammons
@markehammons
yeah, almost definitely
Martijn Hoekstra
@martijnhoekstra
also, almost certainly cheaper than getting a system time, and less error-prone (system clocks get reset too)
Mark Hammons
@markehammons
@martijnhoekstra well, i'm still using System.currentTimeMillis as the first sort, I only sort on the Long value if the two times match
mainly cause I use the ms time to determine if a request should even be bothered with anymore
gonna have the client specify how long they can wait for the request to be served, and if the request is finally reached but time is up, it's treated as if it never existed
Avi
@123avi
Guys, if you didn't participate , please select your favorite DI framework in this form https://goo.gl/forms/FVHvAcDXgMgxAwpb2 it will take less than 5 sec .
Dominic Egger
@GrafBlutwurst
I hope "manual" also includes plain old parameters
PsyfireX
@PsyfireX
You should add "none" to the list.
Martijn Hoekstra
@martijnhoekstra
manual includes etc
so that's a safe bet
PsyfireX
@PsyfireX
That is not a safe bet IMO
Dominic Egger
@GrafBlutwurst
it's what I went for
Martijn Hoekstra
@martijnhoekstra
it's what I went for as well. But you could indeed not do any DI at all
and in that case, you need both a stern talking to, and a "none" option
PsyfireX
@PsyfireX
I wouldn't put "plain old parameters" and "implicits" in the same category.
Martijn Hoekstra
@martijnhoekstra
I bet you wouldn't put "etc" in that category either
PsyfireX
@PsyfireX
What is in the category of etc?
By "none" I meant no framework, which usually means "plain old parameters" or structuring your code in a way where you don't have many dependencies
Martijn Hoekstra
@martijnhoekstra
I don't know
PsyfireX
@PsyfireX
Exactly
:)
Martijn Hoekstra
@martijnhoekstra
maybe global variables? that's sort of implicits
it's a relatively broard category
Dominic Egger
@GrafBlutwurst
the only correct choice is "refuse to write code that 'requires' DI"
PsyfireX
@PsyfireX
^ Agreed
Martijn Hoekstra
@martijnhoekstra
what, and not have any dependencies?
Fabio Labella
@SystemFw
I think you're just disagreeing on the meaning of "DI"
Martijn Hoekstra
@martijnhoekstra
or construct them yourself in the bodies of your methods -- destroying any chance of parametricity?
Fabio Labella
@SystemFw
if by "DI" you include passing dependencies manually
then "avoid DI" is pretty nonsensical
if by "DI" you mean "magic frameworks"
then I agree
Martijn Hoekstra
@martijnhoekstra
If "manual (e.g. passing constructor parameters)" is given as an option on what DI you use, I think it should be obvious that it's not limited to magic frameworks in this context
Fabio Labella
@SystemFw
I agree :)