Is Guava RateLimiter thread-safe - guava

Couldn't find definite answer via googling, stackoverflow search and on github as well about this, but is Guava RateLimiter thread-safe?

Yes it is. Found it in source code.
https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/RateLimiter.java#L41-L42

Related

Cache system in Scala

I´m looking to implement a Cache solution in Scala to cache some Finagle services that I want to avoid create per request if the host and path are alike.
I've read several solutions, Guava, Memo patter of Scalaz, or even using Map.
Could you please give me any recommendation?
Regards
Guava Cache is an excellent library for this, and it is stable and high quality.
https://github.com/google/guava/wiki/CachesExplained

ScalaJS: What's the state of the art for cross-platform dates?

I'm using ScalaJS with Play. Many of the models I'd like to use on both JS and JVM platforms involve dates and times. Given the lack of a cross-platform date/time library, how are people approaching this?
Things I know about:
scalajs-java-time project (https://github.com/scala-js/scala-js-java-time) to port JDK8's java.time api to Scala.js. Unfortunately, it's far from complete and judging by the commit logs, seems to have stalled.
https://github.com/mdedetrich/soda-time is a port of JodaTime to Scala/Scala.js. But it's not ready for production use.
An old post at https://groups.google.com/forum/#!topic/scala-js/6JoJ7x-VxLA suggests storing milliseconds in shared code and then doing implicit conversions on each platform to either js.Date or JodaTime. But we really need a common interface, which this doesn't give.
Li Haoyi's excellent "Hands-on Scala.js" has a simple cross-platform library (http://www.lihaoyi.com/hands-on-scala-js/#ASimpleCross-BuiltLibrary) that could, in theory, be extended to come up with an API in /shared that delegates to JodaTime on the jvm and Momento on js -- but that sounds like a lot of work.
(added later) https://github.com/soc/scala-java-time is based on an implementation of java-time that was contributed to OpenJDK. The README claims that most stuff is working. Right now, this looks like the most promising approach for my needs.
Any advice from those who have gone before me? Right now the fourth options seems like my best bet (with the API limited to stuff I actually use). I'm hoping for something better.
I was in the same boat as you, and the best solution I came up with was cquiroz's scala-java-time library. From reading the comments to your question above, it appears you landed at the same place eventually!
I came here from a google search, and given how much better this solution is than the alternatives you mentions above, let's consider marking this question as resolved for future visitors.

How to build a ConcurrentLinkedHashmap using Guava?

Several links show that https://code.google.com/p/concurrentlinkedhashmap/ has been ported to Guava, but I can not find the corresponding API in Guava.
Can anybody show me an example to build a ConcurrentLinkedHashmap using Guava ?
Thanks!
ConcurrentLinkedHashmap API wasn't ported to Guava 1:1, but some solutions from CLHM were used in MapMaker and Cache (with CacheBuilder).
ConcurrentLinkedHashmap's author Ben Manes answers a question which may clarify your doubts: What does it mean that ConcurrentLinkedHashMap has been integrated into Guava?:
Guava is the long term replacement and most of the time you should use it. The history is that ConcurrentLinkedHashMap figured out the algorithms, Guava subsumed it, and then focused on adding features.
I think it's also important to note that he's currently writing another library which may suit your needs:
Caffeine is a Java 8 rewrite of Guava's cache. It tries to provide the best of ConcurrentLinkedHashMap and Guava, modernized with Java 8, and adopting the techniques that I've learned since those previous projects.

Is MongoDB-backed persistence still in Akka?

I found some docs for mongodb persistence in Akka 1.0, but can't seem to find any mention of it in the 1.2 docs. Was it removed? I also can't find anything that says it was removed or deprecated.
If it is still in Akka, any links to relevant docs would be appreciated.
Thanks!
Unfortunately, they decided to remove it in Akka 1.1: http://groups.google.com/group/akka-user/browse_thread/thread/8867fd5c9d64db4e

How is scala.util.parsing.ast.Binders supposed to be used?

I am currently implementing a small compiler in Scala and while I was doing the component for context analysis I discovered the trait Binders in package scala.util.parsing.ast (I am using Scala 2.9 RC), which is Documented to enable name binding during parse time. That sounds very interesting and I have been googling around a lot, but I still have no clue how to use it. While I am of course able to let my abstract syntax derrive from Binders I dont see how to proceed from there. Are there any examples of the usage on the net?
By googling a bit I found this page, which seems to be a development version of a documentation with more details. Unfortunately I was not able to find online (I mean, outside a source repository) version of these documentations.
I'm not sure however that you will find what you're looking for in this library. Name resolution is a rather delicate thing, and it smells like a questionable idea to do it during parsing. The documentation of this library itself highlights that it is only suitable for languages where the name resolution is relatively simple, and may not scale otherwise. Besides, none of the parsing examples in the Scala repository make use of this class.
I would cautiously avoid this uncharted territory, and design binding analysis in a separate post-parsing pass.
You're not supposed to use it. In fact, it has recently been deprecated.
See
deprecation candidate: scala.parsing.ast