Avoid NPE when calling `getTotalKeys()` before `ManagedSelector` is started.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
8d87a80410
commit
4f3b4a092d
|
@ -148,7 +148,8 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
@ManagedAttribute(value = "Total number of keys", readonly = true)
|
||||
public int getTotalKeys()
|
||||
{
|
||||
return _selector.keys().size();
|
||||
Selector selector = _selector;
|
||||
return selector == null ? 0 : selector.keys().size();
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "Average number of selected keys", readonly = true)
|
||||
|
|
Loading…
Reference in New Issue