// What do we do if serviceName is null at this point???
if (serviceName == null)
serviceName = msgContext.getService().toString();
// look in incoming session
Session session = msgContext.getSession();
if (session != null) {
// This part isn't thread safe...
synchronized (session) {
// store service objects in session, indexed by class name
Object obj = session.get(serviceName);
if (obj == null) {
obj = getNewServiceObject(msgContext, clsName);
session.set(serviceName, obj);
}
return obj;
}
} else {
// was no incoming session, sigh, treat as request scope
scopeHolder.value = Scope.DEFAULT.getValue();
return getNewServiceObject(msgContext, clsName);
}
} else if (scope == Scope.APPLICATION) {
// MUST be AxisEngine here!
AxisEngine engine = msgContext.getAxisEngine();
Session appSession = engine.getApplicationSession();
if (appSession != null) {
// This part isn't thread safe
synchronized (appSession) {
// store service objects in session, indexed by class name
Object obj = appSession.get(serviceName);
if (obj == null) {
obj = getNewServiceObject(msgContext, clsName);
appSession.set(serviceName, obj);
}
return obj;
}
} else {
// was no application session, sigh, treat as request scope