Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 18 19:35
    @SethTisue banned @lunaterra22
  • Sep 14 18:08
    @SethTisue banned @discjock:matrix.org
  • Sep 12 20:37
    @SethTisue banned @manuelzamoratetherbtcusa:matrix.org
  • Sep 06 14:29
    @SethTisue banned @white_hat_hacker:minds.com
  • Sep 06 14:29
    @SethTisue banned @alexchole:matrix.org
  • Aug 31 17:03
    @SethTisue banned @andersonwatts7:matrix.org
  • 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
Martijn Hoekstra
@martijnhoekstra
then it's import scala.collection.immutable.List
RoelofWobben
@RoelofWobben
then I have to figure out how to use flatmap
back to the book
Mark Hammons
@markehammons
ok, yesterday I was talking about using sortedset to handle a request queue
Martijn Hoekstra
@martijnhoekstra
yeah, you did. It seemed like a fun problem
Mark Hammons
@markehammons
and now I've revised my design to get the heads of all the queues in children nodes to find the earliest request
Martijn Hoekstra
@martijnhoekstra
though I didn't really understand the exact requirements
Mark Hammons
@markehammons
I have lock requests. The locks can be on files or directories, and they can be recursive or single file only
read locks do not block additional read locks being made, but block something from getting a write lock on a file till all read locks have been purged
write locks block everything including other write locks
if there's any locking in the LockTrie I wrote, the blocked request goes into a request trie
when a file is released from locks in the lock trie, then that file path is returned by the lock trie and I can look for all requests in the requests trie that fit that path
in order of arrival hopefully
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
:)