use of javax.json.bind.Jsonb in project meecrowave by apache.
the class MeecrowaveClientLifecycleListener method clientDestroyed.
@Override
public void clientDestroyed(final Client client) {
try {
final ClientProviderFactory cpf = ClientProviderFactory.class.cast(client.getEndpoint().get(ClientProviderFactory.class.getName()));
final Collection<Object> invoke = Collection.class.cast(getReadersWriters.invoke(cpf));
invoke.stream().map(p -> ProviderInfo.class.isInstance(p) ? ProviderInfo.class.cast(p).getProvider() : p).filter(p -> !ConfigurableBus.ConfiguredJsonbJaxrsProvider.class.isInstance(p) && JsonbJaxrsProvider.class.isInstance(p)).map(JsonbJaxrsProvider.class::cast).map(p -> {
try {
return ((AtomicReference<Jsonb>) delegate.get(p)).get();
} catch (final IllegalAccessException e) {
throw new IllegalStateException(e);
}
}).filter(Objects::nonNull).filter(JohnzonJsonb.class::isInstance).map(JohnzonJsonb.class::cast).distinct().forEach(jsonb -> CDI.current().select(JohnzonCdiExtension.class).get().untrack(jsonb));
} catch (final RuntimeException re) {
new LogFacade(MeecrowaveClientLifecycleListener.class.getName()).debug(re.getMessage(), re);
} catch (final Exception re) {
// reflection etc which shouldn't fail
new LogFacade(MeecrowaveClientLifecycleListener.class.getName()).error(re.getMessage(), re);
}
}
Aggregations