cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From torehal...@apache.org
Subject svn commit: r451130 - /incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYHessianConnection.m
Date Fri, 29 Sep 2006 05:27:34 GMT
Author: torehalset
Date: Thu Sep 28 22:27:34 2006
New Revision: 451130

URL: http://svn.apache.org/viewvc?view=rev&rev=451130
Log:
auto reconnect

Modified:
    incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYHessianConnection.m

Modified: incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYHessianConnection.m
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYHessianConnection.m?view=diff&rev=451130&r1=451129&r2=451130
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYHessianConnection.m (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYHessianConnection.m Thu Sep 28
22:27:34 2006
@@ -20,6 +20,7 @@
 #import "CAYHessianConnection.h"
 #import "CAYClientMessage.h"
 #import "CAYCocoaCayenne.h"
+#import "CAYMissingSessionException.h"
 
 @implementation CAYHessianConnection
 
@@ -45,7 +46,7 @@
 -(void)connect
 {
     id result1 = [[self proxy] callSynchronous:@"establishSession" withParameters:nil];
-    NSLog(@"establishSession result: %@", result1);
+    NSLog(@"DEBUG: establishSession result: %@", result1);
 }
 
 -(void)updateClassMapping:(NSDictionary *)cm
@@ -57,6 +58,23 @@
 {
 	NSArray *parameters = [NSArray arrayWithObject:message];
     id result = [proxy callSynchronous:@"processMessage" withParameters:parameters];
+    
+    if([result isKindOfClass:[NSError class]])
+    {
+        NSError *err = (NSError *)result;
+        NSDictionary *userInfo = [err userInfo];
+        id underlyingError = [userInfo valueForKey:NSUnderlyingErrorKey];
+        
+        if([underlyingError isKindOfClass:[CAYMissingSessionException class]])
+        {
+            NSLog(@"ERROR: missing session. try to reconnect.");
+            [self connect];
+            // reissue processMessage with the new session
+            result = [proxy callSynchronous:@"processMessage" withParameters:parameters];
+            NSLog(@"DEBUG: processMessage (after reconnect) result: %@", result);
+        }
+    }
+    
 	return result;
 }
 



Mime
View raw message