These are chat archives for atomix/atomix

28th
May 2018
Jordan Halterman
@kuujo
May 28 2018 10:44

I did a lot of work on getting Atomix 2.1 into ONOS last week. I got most of the way there, but ran into some problems with Java’s ServiceLoader and OSGi. I hate that pattern anyways, so I’m rewriting the configuration layer completely. It’s going to be a big code change, but it’s all just configuration so shouldn’t be an issue.

I changed the configuration format to JSON/HOCON. Rather than using ServiceLoader, types are just specified in a registry as part of the configuration. For example, primitive types can be added via a configuration file:

registry.primitiveTypes.lock {
  primitiveClass: io.atomix.core.lock.DistributedLock
  configClass: io.atomix.core.lock.DistributedLockConfig
  serviceClass: io.atomix.core.lock.impl.DistributedLockService
}

primitives.myLock {
  type: lock
  protocol {
    type: multi-raft
    group: consensus
    sessionTimeout: 5000
  }
}
DistributedLock lock = atomix.getPrimitive(“myLock”, “lock”);

This allows for a lot of the configuration to be written in HOCON as part of the core. I was able to delete a lot of ugly factories and meta-classes. Of course, the usual pattern of allowing Atomix to be configured in code or in a configuration file is maintained and will always be maintained.

BTW I think maybe we should bump the version to 3.0 instead of 2.1
Just skip 2.x
Johno Crawford
@johnou
May 28 2018 15:40
HOCON?
not heard of it
bit of a shame that osgi and serviceloader didn't play nice
what type of issues did you actually run into?
Johno Crawford
@johnou
May 28 2018 17:07
superset of json?
any benefits over say, yaml?
Johno Crawford
@johnou
May 28 2018 19:22
@kuujo I may have accidentally nuked your phi branch :smile:
Managed to recover it I think
Ronnie
@rroller
May 28 2018 21:05
This is hacon @johnou https://github.com/lightbend/config
Jordan Halterman
@kuujo
May 28 2018 21:13
you can get ServiceLoader to work with OSGi but it’s a major PITA
this turns out much nicer
yeah basically it’s a configuration format written for Akka
supports something like inheritence which makes configuration files easy to lay out
the core can have a core configuration and users can extend it just by adding new files
HOCON is basically a JSON syntax that’s much nicer for configuration, supports variable substitution, references, and other things that make it more convenient than a more general format