Database Reference
In-Depth Information
deleteTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:selector
userInfo:nil
repeats:YES];
selector = @selector (testChildInsertion);
childInsertTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:selector
userInfo:nil
repeats:YES];
selector = @selector (testChildDeletion);
childDeleteTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:selector
userInfo:nil
repeats:YES];
selector = @selector (testObjectFetch);
fetchTimer = [NSTimer scheduledTimerWithTimeInterval:15.0
target:self
selector:selector
userInfo:nil
repeats:YES];
}
The -startTestTimers fires up a number of timers that continuously call our test
methods. We retain a reference to each of these timers so we can later shut
them down gracefully.
-disconnect Implementation
Whenever we shut down the client application, we want to shut down the
timers, and we want to close the connection to the server. The -disconnect walks
through each of the NSTimer references and invalidates them. Once all the
timers are shut down, it retrieves the NSConnection from the server proxy and
invalidates it.
DistributedCDClient/AppDelegate.m
- ( void )disconnect
{
[pingTimer invalidate], pingTimer = nil;
[fetchTimer invalidate], fetchTimer = nil;
[insertTimer invalidate], insertTimer = nil;
[deleteTimer invalidate], deleteTimer = nil;
[childDeleteTimer invalidate], childDeleteTimer = nil;
[childInsertTimer invalidate], childInsertTimer = nil;
NSConnection *connection = [(NSDistantObject*)server connectionForProxy];
[connection invalidate];
server = nil;
}
 
 
 
Search WWH ::




Custom Search