Additional log on plug-in self-registration and failures.

Whenever a new class is self-registered from a plug-in
additional INFO message is displayed with class name
and listener / exported interface.

Additionally when a Listener fails to get created
from injection into a DynamicSet, an error is logged
allowing the plug-in developer to understand what
was the problem.

Without this patch, you may see your plus-in loading
correctly but then the listeners being discarded
silently and you would spend a lot of time figuring
out where the problem was.

Change-Id: Ief3d3c5a3012136f73296a3afa5c85c22fc38bb7
This commit is contained in:
Luca Milanesio
2012-06-24 21:39:39 +01:00
parent 9d92e48ab0
commit c0732b1301
3 changed files with 15 additions and 1 deletions

View File

@@ -25,6 +25,9 @@ import com.google.inject.name.Named;
import com.google.inject.util.Providers;
import com.google.inject.util.Types;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -39,6 +42,7 @@ import java.util.concurrent.atomic.AtomicReference;
* registrations to decide between singleton and non-singleton members.
*/
public class DynamicSet<T> implements Iterable<T> {
private static final Logger log = LoggerFactory.getLogger(DynamicSet.class);
/**
* Declare a singleton {@code DynamicSet<T>} with a binder.
* <p>
@@ -147,7 +151,8 @@ public class DynamicSet<T> implements Iterable<T> {
try {
next = p.get();
} catch (RuntimeException e) {
// TODO Log failed member of DynamicSet.
log.error("Cannot get iterated object from provider " + p
+ ": object discared", e);
}
}
}