> On 10 Mar 2016, at 13:02, Stahle, Patrick <[email protected]> wrote:
> 
> I mean that if multiple jvms using PDFBox library set the java environmental 
> variable for fontcache to the same location and they are all using the same 
> fontcache directory will there be any issues?

Ok, I see, I thought you were asking about the in-memory font cache. So the 
on-disk font cache just stores some metadata about the fonts on the system. 
Thinking about it, it’s not actually cross-JVM safe, as PDFBox can write to the 
cache on in its static initializers. As long as the fonts on your system don’t 
change, then you’re safe, as many JVMs instances can read safely from the 
cache. But only one JVM can write it.

So, erm, run a single PDFBox instance on a new machine to build the cache 
first. I suppose we should think about adding a locking mechanism.

— John

> -----Original Message-----
> From: John Hewson [mailto:[email protected]] 
> Sent: Thursday, March 10, 2016 3:59 PM
> To: [email protected]
> Subject: Re: font cache & thread safe question
> 
> 
>> On 10 Mar 2016, at 08:09, Stahle, Patrick <[email protected]> wrote:
>> 
>> Hi,
>> 
>> Is the font cache code in pdfbox thread safe? If it is, is it thread safe 
>> just for the jvm or is it thread safe across multiple jvms?
> 
> Yes, it is, because it’s always accessed by FontMapperImpl in a thread safe 
> manner. I’m not sure what you mean about multiple JVMs, objects can’t be 
> shared across JVMs.
> 
>> Thanks,
>> Patrick
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to