I was under an obligation do session bean which method generate unique identifier ( timestamp (yyyymmddhhmmss) + counter). I store last value identifier in database and use strict locking condition (db) - this way I'm sure that it is unique.
I'm looking for more efficient way for solve this problem. I was thinking about store last value in bean static variable with kev word volatile. I know that EJB specyfication is not favourable for using threads features. Is possible using volatile word for synchronize access to static variable ?