[
https://issues.apache.org/jira/browse/AVRO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14387775#comment-14387775
]
ASF GitHub Bot commented on AVRO-607:
-------------------------------------
GitHub user rdblue opened a pull request:
https://github.com/apache/avro/pull/30
AVRO-607. Make SpecificData#getSchema thread-safe.
This adds a version of WeakIdentityHashMap that is thread-safe by
replacing the backing Map implementation with ConcurrentHashMap. Both
WeakIdentityHashmap and the new WeakIdentityConcurrentMap are subclases
of the (new) WeakIdentityMap, which allows subclasses to supply a
backing map implementation.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/rdblue/avro AVRO-607-concurrent-schema-cache
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/avro/pull/30.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #30
----
commit b287db7560928d88b1ef1dd0cc79d1ad3e7cfa1e
Author: Ryan Blue <[email protected]>
Date: 2015-03-31T00:31:36Z
AVRO-607. Make SpecificData#getSchema thread-safe.
This adds a version of WeakIdentityHashMap that is thread-safe by
replacing the backing Map implementation with ConcurrentHashMap. Both
WeakIdentityHashmap and the new WeakIdentityConcurrentMap are subclases
of the (new) WeakIdentityMap, which allows subclasses to supply a
backing map implementation.
----
> SpecificData.getSchema not thread-safe
> --------------------------------------
>
> Key: AVRO-607
> URL: https://issues.apache.org/jira/browse/AVRO-607
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.3.3
> Reporter: Stephen Tu
> Attachments: AVRO-607.patch
>
>
> SpecificData.getSchema uses a WeakHashMap to cache schemas, but WeakHashMap
> is not thread-safe, and the method itself is not synchronized. Seems like
> this could lead to the data structure getting corrupted.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)