if (!ejbDeploymentInformation.getViewNames().contains(viewClassName)) {
this.writeNoSuchEJBFailureMessage(channel, invocationId, appName, moduleName, distinctName, beanName, viewClassName);
return;
}
// TODO: Add a check for remote view
final ComponentView componentView = ejbDeploymentInformation.getView(viewClassName);
final Method invokedMethod = this.findMethod(componentView, methodName, methodParamTypes);
if (invokedMethod == null) {
this.writeNoSuchEJBMethodFailureMessage(channel, invocationId, appName, moduleName, distinctName, beanName, viewClassName, methodName, methodParamTypes);
return;
}
final Object[] methodParams = new Object[methodParamTypes.length];
// un-marshall the method arguments
if (methodParamTypes.length > 0) {
for (int i = 0; i < methodParamTypes.length; i++) {
try {
methodParams[i] = unMarshaller.readObject();
} catch (ClassNotFoundException cnfe) {
// TODO: Write out invocation failure to channel outstream
throw new RuntimeException(cnfe);
}
}
}
unMarshaller.finish();
// invoke the method and write out the response on a separate thread
executorService.submit(new Runnable() {
@Override
public void run() {
// check if it's async. If yes, then notify the client that's it's async method (so that
// it can unblock if necessary)
if (componentView.isAsynchronous(invokedMethod)) {
try {
MethodInvocationMessageHandler.this.writeAsyncMethodNotification(channel, invocationId);
} catch (Throwable t) {
// catch Throwable, so that we don't skip invoking the method, just because we
// failed to send a notification to the client that the method is an async method