Replies: 11 comments 32 replies
-
Hi @lfoppiano! Blackbird is a newer version of Afterburner. Afterburner is getting old and doesn't support Java 9+ well, so we switched to Blackbird in the 2.1.0 release to provide better support for recent Java versions. Java added a |
Beta Was this translation helpful? Give feedback.
-
Maybe it would be better to not activate blackbird for java 8. Previously, afterburner was activated only for java 8, so why not put condition around blackbird : if (!JavaVersion.isJava8()) {
mapper.registerModule(new BlackbirdModule());
} With this, it would be easy to manually activate afterburner for those who need it (blackbird was never positioned to be a good substitution for java 8 - it's compatible , but i'm sure afterburner would be faster). Besides, it is currently a bad default for java 8 because anyone launching even sample app on java 8 would be confused as it does not look like a warning. For production such default can't be used at all (or it would be a nightmare always explainig "why we have an exception on start"). The only way now to hide this "exception" in logs is to override ObjectMapper configuration, but this is, basically, required patching of the defaults. Isn't it better to fix defaults instead. |
Beta Was this translation helpful? Give feedback.
-
Also getting this in a multi-service environment that we need to update dropwizard in across the board. I’m wondering what exactly are the implications of “not running optimally” - if it’s even a mildly noticeable performance hit then in our case it’s a big blocker. |
Beta Was this translation helpful? Give feedback.
-
I showed up to upvote. If the 2.1.x branch is java8 compatible then it shouldn't be emitting this warning. |
Beta Was this translation helpful? Give feedback.
-
One more attempt to refresh the discussion: in case of afterburner it was ok to put jvm version condition around it, why is it not ok now? We just want to get rid of blackbird on java 8: if (!JavaVersion.isJava8()) {
mapper.registerModule(new BlackbirdModule());
} I'm really tired seeing this warning. Please, it is so simple change affecting only java 8 users Also, consider the default behaviour argument: "good defaults" was always a dropwizard selling point. Current default cause pain for java 8 users. I could make a PR if you want. I just can't understand (don't see) your arguments against this and so have no certainty it will be accepted. |
Beta Was this translation helpful? Give feedback.
-
I think we have different purposes in this discussion. To wrap this up: some users completely want to disable Blackbird and some only want to get rid of the generated warning. Clearly, Blackbird can be disabled by default only through modifications of the
This method won't require any modifications of the |
Beta Was this translation helpful? Give feedback.
-
@xvik @sandeepk-veritas @zUniQueX What do you think of #5472? While we won't replace Jackson Blackbird in Dropwizard 2.1.x, this simplifies customizing the You'd have to extend |
Beta Was this translation helpful? Give feedback.
-
Just for completeness sake: I've tried to modify an existing public static class BlackbirdDisablingObjectMapper extends ObjectMapper {
protected BlackbirdDisablingObjectMapper(ObjectMapper src) {
super(src);
BeanDeserializerFactory beanDeserializerFactory = (BeanDeserializerFactory)this._deserializationContext.getFactory();
DeserializerFactoryConfig factoryConfig = beanDeserializerFactory.getFactoryConfig();
DeserializerFactoryConfig deserializerConfig = new DeserializerFactoryConfig();
if (factoryConfig.hasDeserializers()) {
for (Deserializers deserializers : factoryConfig.deserializers()) {
deserializerConfig = deserializerConfig.withAdditionalDeserializers(deserializers);
}
}
if (factoryConfig.hasKeyDeserializers()) {
for (KeyDeserializers keyDeserializers : factoryConfig.keyDeserializers()) {
deserializerConfig = deserializerConfig.withAdditionalKeyDeserializers(keyDeserializers);
}
}
if (factoryConfig.hasDeserializerModifiers()) {
for (BeanDeserializerModifier modifier : factoryConfig.deserializerModifiers()) {
if (!(modifier instanceof BBDeserializerModifier)) {
deserializerConfig = deserializerConfig.withDeserializerModifier(modifier);
}
}
}
if (factoryConfig.hasAbstractTypeResolvers()) {
for (AbstractTypeResolver abstractTypeResolver : factoryConfig.abstractTypeResolvers()) {
deserializerConfig = deserializerConfig.withAbstractTypeResolver(abstractTypeResolver);
}
}
if (factoryConfig.hasValueInstantiators()) {
for (ValueInstantiators valueInstantiators : factoryConfig.valueInstantiators()) {
deserializerConfig = deserializerConfig.withValueInstantiators(valueInstantiators);
}
}
DeserializerFactory newFactory = beanDeserializerFactory.withConfig(deserializerConfig);
this._deserializationContext = this._deserializationContext.with(newFactory);
BeanSerializerFactory beanSerializerFactory = (BeanSerializerFactory)this._serializerFactory;
SerializerFactoryConfig oldConfig = beanSerializerFactory.getFactoryConfig();
SerializerFactoryConfig config = new SerializerFactoryConfig();
if (oldConfig.hasSerializers()) {
for (Serializers serializers : oldConfig.serializers()) {
config = config.withAdditionalSerializers(serializers);
}
}
if (oldConfig.hasKeySerializers()) {
for (Serializers keySerializers: oldConfig.keySerializers()) {
config = config.withAdditionalKeySerializers(keySerializers);
}
}
if (oldConfig.hasSerializerModifiers()) {
for (BeanSerializerModifier modifier : oldConfig.serializerModifiers()) {
if (!(modifier instanceof BBSerializerModifier)) {
config = config.withSerializerModifier(modifier);
}
}
}
this._serializerFactory = ((BeanSerializerFactory) this._serializerFactory).withConfig(config);
this._registeredModuleTypes = this._registeredModuleTypes.stream().filter(moduleType -> !moduleType.equals(BlackbirdModule.class.getName())).collect(Collectors.toSet());
}
@Override
public ObjectMapper copy() {
_checkInvalidCopy(BlackbirdDisablingObjectMapper.class);
return new BlackbirdDisablingObjectMapper(this);
}
} |
Beta Was this translation helpful? Give feedback.
-
Kind of related, please leave your vote (or comments) in this poll: |
Beta Was this translation helpful? Give feedback.
-
We've partially reverted the change with the Jackson Afterburner and Blackbird modules in Dropwizard 2.1.1: While Jackson Blackbird is still the default (as a nudge for people to finally upgrade to Java 11 and later), Dropwizard will automatically prefer the Jackson Afterburner module if it's on the class path. |
Beta Was this translation helpful? Give feedback.
-
Found an issue about Blackbird logs even with Afterburner being used in our application. Background:
We are no longer getting exception when we start application on console like we used to get earlier. I had also added following in yaml:
But recently I thought it is completely unnecessary now, hence removed it. Now getting below logs from BlackbirdModule when we run our first API request. This is getting logged in log file only, not on console.
I am also seeing one similar issue in our client module. Will provide information with more details. |
Beta Was this translation helpful? Give feedback.
-
I'm running a dropwizard application which I've just updated to dropwizard 2.1. I'm also using
I'm using afterburner and jdk 8 and I get
com.fasterxml.jackson.module.blackbird.BlackbirdModule: Unable to find Java 9+ MethodHandles.privateLookupIn. Blackbird is not performing optimally!
at startup. See below for the full stacktrace.Steps to reproduce the behavior:
I would like to understand what is the issue and how to solve it. Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions