[jboss-user] [J2EE Design Patterns] - Re: Exception handling in Bulk calls
kapil.singhal
do-not-reply at jboss.com
Tue Jan 30 01:58:41 EST 2007
Hello,
The following code snippet is getting Displet color detail in a single call based on Object Id. The second method getDipletColorDetails() is calling the above method getDispletColorDetail() in a for() loop for the no. of iterations. Now if there are 100 iterations and an exception is being raised after 50 iterations due to some error, what about the result of 50 iterations as I have already called the single(first) method 50 times. I want to store and return the result of the executed calls to the client before the exception is being raised.
| @WebMethod
| public DispletColorDetail getDispletColorDetail (int aSessionId, ObjectId aDispletId)
| {
| mLogger.debug("SessionId: ", aSessionId, "; getDispletColorDetail - DispletId: ", aDispletId);
|
| SessionObject session = validateSession(aSessionId, "getDispletColorDetail");
| validateNotNull(aDispletId, "getDispletColorDetail",
| "Please provide a valid Object id of a Displet, required for getting the DispletColorDetail.");
|
| Displet displet = demarshallDisplet(aDispletId);
|
| DispletColorDetail result = null;
| try
| {
| result = marshallColorDetail(displet);
| }
| catch (Exception e)
| {
| throwInternalError("getDispletColorDetail", e,
| "Unexpected error occurred while getting Displet Color Detail. Please contact Barco Customer Support.", "SessionId", aSessionId,
| "ObjectId", aDispletId);
| }
|
| mLogger.debug("Session: ", session, "; getDispletColorDetail returned, result: ", result);
| return result;
| }
|
|
| @WebMethod
| public DispletColorDetail[] getDispletColorDetails (int aSessionId, ObjectId[] aDispletIdList)
| {
| mLogger.debug("SessionId: ", aSessionId, "; getDispletColorDetails - DispletIdList: ", aDispletIdList);
|
| SessionObject session = validateSession(aSessionId, "getDispletColorDetails");
| validateNotNull(aDispletIdList, "getDispletColorDetails",
| "Please provide a valid ObjectId list of Displets, required for getting the corresponding DispletColorDetails.");
|
| DispletColorDetail[] result = new DispletColorDetail[aDispletIdList.length];
| for (int i = 0; i < aDispletIdList.length; i++)
| {
| result = getDispletColorDetail(aSessionId, aDispletIdList);
| }
|
| mLogger.debug("Session: ", session, "; getDispletColorDetails returned, result: ", result);
| return result;
| }
|
I hope I am able to clear the problem.
Please suggest.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008147#4008147
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4008147
More information about the jboss-user
mailing list