title: unique id in java thread
body: <p>My application uses a logging component which needs to keep track of a unique identifier for each call. </p>
  
  <p>My starting point is an MDB which obviously initiates a series of methodcalls to several classes.
  Each class creates a new logger-object, similar to log4j, and uses this to log events to the database. And for each logger-object that gets created, a unique identifier is assigned to it. This identifier should follow the thread until the subsequent calls all return and the onMessage-method in my MDB terminates.</p>
  
  <p>The problem is that during the processing of one JmsMessage,  another message is received by the MDB and my IDs get mixed up.</p>
  
  <p>I have been banging my head against the desk for some time now and I guess the answer is right in front of me, but have you got any ideas? How can I make sure that one "process" can log using its own ID even if another is started before the first one finishes?</p>
  
  <p>Thank you in advance.</p>