This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 31, 2011, 4:59 PM
4 Posts

Java Bean Thread Safe?

  • Category: Managed Beans in NSF
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: Java Beans
  • Replies: 9
 Hi,
 
I have some java code which generates a barcode image (using an external java library) - currently the image is saved on the filesystem of the server as well as being written directly to the output stream.  
 
I have the bean successfully wired up to an XPage such that it extracts the key from the url and passes it to the underlying bean.  The bean has been specified in the faces context configuration with a request scope. 
 
So a HTML img tag like this - <img src="http://192.168.1.30/barcodedemo.nsf/test.xsp?openxpage&key=test"/> will successfully return a barcode image - the problem arises when I have several image tags on the same page - the server throws an error and the images do not get returned except for the first one.
 
Interestingly if I refresh the page the first image gets returned and then the next one gets generated the rest error and so on.  There must be some caching going on there. 
 
The reason why I am saving the images on the server is to get around this issue - I would generate the barcode on a per document basis and then in a view refer to file versions.
 
Will blog the solution (was going to about the barcode generation) - just wondered if anyone else had come across the problem.
 
Mark 
Jun 1, 2011, 7:13 AM
33 Posts
Re: Java Bean Thread Safe?
I don't think there is a need for managed bean. You can take the code from the bean and put it directly into the xpage.
Jun 1, 2011, 8:21 AM
4 Posts
Re: Java Bean Thread Safe?
 Ok I will give that a go.
 
Thanks. 
Jun 1, 2011, 9:12 AM
4 Posts
Re: Java Bean Thread Safe?
 Unfortunately that didn't cure the problem.
 
 
Jun 1, 2011, 9:31 AM
33 Posts
Re: Java Bean Thread Safe?
Then there is probably some error in your code. Would you mind to share it so we can help?
Jun 1, 2011, 8:04 AM
54 Posts
Re: Java Bean Thread Safe?
My "vote" goes also for the direct XPages solution. You can run Java code directly in XPages.

Really handy that you can mix program languages like that !! :)
Jun 1, 2011, 9:30 AM
33 Posts
Re: Java Bean Thread Safe?
Then there is probably some error in your code. Would you mind to share it so we can help?
Jan 24, 2014, 2:32 AM
2 Posts
Java code

Hi, sorry to bump an old thread. But I happened to see ur issue. I'm recently using a Java barcode library to generate code 128, but somehow it didn't work. I think something might go wrong with my code. Can u post some sample code snippet please?  And how to do the settings for it automatically generate on each of the documetn pages? Thanks in advance!

Jun 30, 2014, 9:40 AM
1 Posts
Barcode for Java

The barcode generator software is a Java library that enables the creation of barcodes in a variety of standard formats that can be displayed as Swing/AWT components. Java barcode packages are provided in convenient JAR files. Each symbology type is combined into a single JAR file with the Applet, Servlet, and Class Library.

Feb 10, 2015, 2:44 AM
1 Posts
Thread safe queue in Java

I am a developer of java barcode generator,my work is to develope qrcode in java,but i am new to thread safe queue in Java.

I want to implement a queue, that is hit by multiple threads.

This is stack is in a singleton class.

Now, a simple solution is to synchronize this? I assume it would need this as standard? However, I want to prioritize writing to it.

So, write is high priority, read is low priority.

Is this possible?

Ideally writing by multiple threads without synchronizing would be great, if possible.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal