-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
extensions/avro/runtime/src/main/java/io/quarkus/avro/runtime/AvroRecorder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.quarkus.avro.runtime; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.Map; | ||
|
||
import org.apache.avro.specific.SpecificData; | ||
import org.jboss.logging.Logger; | ||
|
||
import io.quarkus.runtime.annotations.Recorder; | ||
|
||
@Recorder | ||
public class AvroRecorder { | ||
|
||
private static final Logger log = Logger.getLogger(AvroRecorder.class); | ||
|
||
public void clearStaticCaches() { | ||
try { | ||
Field instanceField = SpecificData.class.getDeclaredField("INSTANCE"); | ||
instanceField.setAccessible(true); | ||
SpecificData data = (SpecificData) instanceField.get(null); | ||
Field classCache = SpecificData.class.getDeclaredField("classCache"); | ||
classCache.setAccessible(true); | ||
Map<String, Class> classCacheMap = (Map<String, Class>) classCache.get(data); | ||
classCacheMap.clear(); | ||
} catch (Throwable t) { | ||
log.error("Failed to clear Avro cache", t); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...quarkus/avro/graal/AvroSubstitutions.java → ...avro/runtime/graal/AvroSubstitutions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters