// Get the Method via MethodInfo from the Advisor
Advisor advisor = this.getAdvisor();
MethodInfo info = advisor.getMethodInfo(methodHash);
Method unadvisedMethod = info.getMethod();
SerializableMethod unadvisedMethodSerializable = new SerializableMethod(unadvisedMethod);
// Get the invoked method from invocation metadata
Object objInvokedMethod = si.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,
SessionSpecRemotingMetadata.KEY_INVOKED_METHOD);
assert objInvokedMethod != null : "Invoked Method must be set on invocation metadata";
assert objInvokedMethod instanceof SerializableMethod : "Invoked Method set on invocation metadata is not of type "
+ SerializableMethod.class.getName() + ", instead: " + objInvokedMethod;
SerializableMethod invokedMethod = (SerializableMethod) objInvokedMethod;
/*
* Set the invoked method
*/
//TODO Remove when CurrentInvocation is ironed out
// Set onto stack
SessionSpecContainer.invokedMethod.push(invokedMethod);
try
{
// Increment invocation statistics
invokeStats.callIn();
/*
* Obtain Session ID
*/
// Obtain the Session ID
Object objSessionId = si.getMetaData(StatefulSessionRemotingMetadata.TAG_SFSB_INVOCATION,
StatefulSessionRemotingMetadata.KEY_SESSION_ID);
if (objSessionId != null)
{
assert objSessionId instanceof Serializable : "Session IDs must be "
+ Serializable.class.getSimpleName();
sessionId = (Serializable) objSessionId;
}
if (info != null && unadvisedMethod != null && isHomeMethod(unadvisedMethodSerializable))
{
response = invokeHomeMethod(info, si);
}
else if (info != null && unadvisedMethod != null && isEjbObjectMethod(unadvisedMethodSerializable))
{
response = invokeEJBObjectMethod(invokedMethod, si);
}
else
{
if (unadvisedMethod.isBridge())
{
unadvisedMethod = this.getNonBridgeMethod(unadvisedMethod);
info = super.getMethodInfo(unadvisedMethod);
}
if (sessionId == null)
{
StatefulBeanContext ctx = getCache().create(null, null);
Object objNewId = ctx.getId();
assert objNewId instanceof Serializable : "Obtained new Session ID from cache, " + objNewId
+ ", which is not " + Serializable.class.getSimpleName();
sessionId = (Serializable) objNewId;
}
/*
* Build a new Invocation
*/
// Construct the invocation
newSi = new StatefulContainerInvocation(info, sessionId);
//newSi = new StatefulContainerInvocation(info.getInterceptors(), long methodHash, Method advisedMethod, Method unadvisedMethod, Advisor advisor, Object id);
newSi.setArguments(si.getArguments());
newSi.setMetaData(si.getMetaData());
newSi.getMetaData().addMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,
SessionSpecRemotingMetadata.KEY_INVOKED_METHOD, invokedMethod, PayloadKey.AS_IS);
//newSi.setAdvisor(getAdvisor());
/*
* Ensure ID exists (useful for catching problems while we have context as
* to the caller, whereas in Interceptors we do not)
*/
try
{
this.getCache().get(sessionId);
}
catch(NoSuchEJBException nsee)
{
throw this.constructProperNoSuchEjbException(nsee, invokedMethod.getActualClassName());
}
/*
* Perform Invocation
*/