Amadeu Cabanilles Amadeu Cabanilles - 3 months ago 19
Java Question

java ConcurrentMap get in null

I have this ConcurrentMap

ConcurrentMap<String, Byte[]> companyLogo = new MapMaker()
.expiration(24, TimeUnit.HOURS)

and this piece of code

companyLogo.put("cpr48124", ArrayUtils.toObject(resize (request, ((Byte[])request.getSession().getAttribute(COMPANY_LOGO_KEY+ imageId)))));

is null. How can it be possible ?


I'm not familiar with MapMaker is, but I'd guess that weakKeys might be your problem.

It is likely that the 'weakness' of your new entry is making it unavailable since there are no other references to it.