BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 03-01-2007, 11: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

1 Lot of 25 Transistors 2N6509. New parts
$19.99
1 Lot of 25 Transistors 2N6509.  New parts  picture50pcs TO-92 BC548 Amplifier Transistor DIP NPN
$2.29
50pcs TO-92 BC548 Amplifier Transistor DIP NPN pictureIRFP4229 Transistor N-MOSFET 250V 44A 310W TO247AC NEW
$2.68
IRFP4229 Transistor N-MOSFET 250V 44A 310W TO247AC NEW picture1000pcs TO-92L 2SC1384 NPN Amplifier Transistor
$25.19
1000pcs TO-92L 2SC1384 NPN Amplifier Transistor picture2PCS IRFP044N Transistor N-MOSFET 55V 53A 120W TO247AC NEW
$2.35
2PCS IRFP044N Transistor N-MOSFET 55V 53A 120W TO247AC NEW   picture






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