BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 03-01-2007, 11:58 AM   #1
zhangbb
New Member
 
Join Date: Mar 2007
Model: 7105t
Carrier: T-Mobile
Posts: 3
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Devolinx STE-502C 2-Port RS-232/422/485 To Ethernet Device Server picture

Devolinx STE-502C 2-Port RS-232/422/485 To Ethernet Device Server

$89.99



Server Hosting Domain ranhost.com Domain Name for Sale picture

Server Hosting Domain ranhost.com Domain Name for Sale

$800.00



USA Windows VPS RDP Server/ Windows VPS Hosting - 4GB RAM + 150GB HDD picture

USA Windows VPS RDP Server/ Windows VPS Hosting - 4GB RAM + 150GB HDD

$11.99



30 Server/Guest Pager Restaurant Paging System Kit by LRS Long Range Systems picture

30 Server/Guest Pager Restaurant Paging System Kit by LRS Long Range Systems

$299.99



Electric Food Warmers 4-Pan Buffet Server With Lid And Tap 110V Stainless Steel picture

Electric Food Warmers 4-Pan Buffet Server With Lid And Tap 110V Stainless Steel

$120.29



Hubbell NXBTC NX Bluetooth Radio Module with Time Server -  picture

Hubbell NXBTC NX Bluetooth Radio Module with Time Server -

$129.99







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