Is the following thread safe? The fact that this is a static method scares me a bit,
ie, will MessageContext.getCurrentContext() hold true in situations like this or is it
possible that as two threads enter this method simultaneously...things could get a
little funky.
public static RequestHandler getInstance() {
RequestHandler handler = null;
MessageContext mc = MessageContext.getCurrentContext();
if (mc != null && mc.getService() != null) {
String serviceName = mc.getService().getName();
if (serviceName != null) {
if (serviceName.equalsIgnoreCase("SomeServiceName")) {
handler = new TNowAirHandler();
}
}
}
return handler;
}