BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-01-2007, 10:58 AM   #1 (permalink)
New Member
 
Join Date: Mar 2007
Model: 7105t
Carrier: T-Mobile
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default interprocess communication

Please Login to Remove!

I was wondering whether there are any restrictions on the use of Objects passed between processes via ApplicationManager.postGlobalEvent or the RuntimeStore.

On the device I have a GUI application that interacts with the user and a daemon application that the GUI application calls to perform tasks. I would like to be able to pass a callback interface from the daemon application to the GUI application. So in a shared library I might have a DaemonServices callback interface:

Code:
public interface DaemonServices {
    public long executeTask1();
    public long executeTask2();
    public int getStatus(long taskID);
    ...
}
The daemon would pass an instance of this interface to the GUI application:

Code:
DaemonServices daemonCallback = new DaemonServicesImpl();
appMgr.postGlobalEvent(guiPid, EnumEvents.REGISTER_CALLBACK_EVENT, 0, 0, daemonCallback, null);
The GUI application would receive the callback interface, and could then use it to execute tasks in the daemon:

Code:
private DaemonServices _daemonCallback;

private class GUIGlobalEventListener implements GlobalEventListener {
    public void eventOccurred(long guid, int data0, int data1, Object object0, Object object1) {
        if (guid == EnumEvents.REGISTER_CALLBACK_EVENT) {
            _daemonCallback = object0;
        }
    }
}
....
private void someInternalMethod() {
    long taskID = _daemonCallback.executeTask1();
    ...
}
The methods on DaemonServices would be non-blocking. For example, executeTask1() would simply cause a task to be queued for a daemon thread to execute later. Also, the daemon application would be a system application that is started when the device starts up, so it would always be alive when the GUI tries to communicate with it.

This model (having a thread in one application perform operations in another application) seems to violate process isolation somewhat, but the RIM API clearly supports it. Am I safe in using this model as long as I'm careful about how I implement the DaemonServices operations? Are there any other problems I could run into--for example, if the device was shutting down and the daemon application terminated before the GUI application?

Thanks...
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.