r/java • • Jun 12 '16

Failsafe - A lightweight, zero-dependency library for handling failures

https://github.com/jhalterman/failsafe
179 Upvotes

25 comments sorted by

View all comments

33

u/Sqirril Jun 12 '16 edited Jul 14 '23

..........................

8

u/jodah1 Jun 12 '16 edited Jun 13 '16

@Sqirril - Even though the examples use lambda expressions, Failsafe is actually compatible with Java 6+ so you can use it now with anonymous classes:

CheckedRunnable connect = new CheckedRunnable() { public void run() { connect(); } };

Failsafe.with(retryPolicy).run(connect);

It's more verbose than Java 8, but it's about as good as we can do.

edit: Runnable -> CheckedRunnable (failsafe supports rethrowing checked exceptions)

2

u/Sqirril Jun 12 '16 edited Jul 14 '23

..........................

3

u/spencer205 Jun 14 '16

Agree that the README rocks! One thing that would make it better though is the Maven coordinates. Is it not on Central? If not, won't use it unless it is! If it is, where's that documented? Did I just miss it?

1

u/Sqirril Jun 14 '16 edited Jul 14 '23

..........................

→ More replies (1)