Pass messages between main thread and FX application thread

I'm launching an FX Application thread from a Main thread using Application.launch [outlined here: {thread:id=2530636}]
I'm trying to have the Aplication thread return information to the Main thread, but Application.launch returns void. Is there an easy way to communicate between the Main thread and the Application thread?
So far I have googled and found:
- MOM (Message Orientated Middleware)
- Sockets
Any thoughts/ideas/examples are appreciated - especially examples ;) - right now I am looking at using Sockets to show/hide the application and for passing data.
What is the preferred method? Are there others which I have not found (gasp) via Google?
Dave.
Edited by: cr0ck3t on 30-Apr-2013 21:04
Edited by: cr0ck3t on 30-Apr-2013 21:05

Is there an easy way to get a reference to these objects from both the Main thread and the FX Application thread - called via Application.launch() from the Main thread? Or do I have to use Sockets or MOM?Not much to do with concurrent programming is what I would call easy. It seems easy - but it's not.
You can kind of do what you are describing using Java concurrency constructs without using sockets or some Message Oriented Middleware (MOM) package.
With the Java concurrency stuff you are really implementing your own form or lightweight MOM.
If you have quite a complex application with lots of messages going back and forth then some kind of MOM package such as camel or ActiveMQ (http://camel.apache.org) is useful.
You can find a sample of various thread interactions with JavaFX here:
https://gist.github.com/jewelsea/5500981 "Simulation of dragons eating dwarves using multiple threads"
Linked code is just demo-ware to try out different concurrency facilities and not necessarily a recommended strategy.
If your curious, you could take a look at it and try to work out what it is, what it does and how it does it.
The main pattern followed is that from a blocking queue:
http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/BlockingQueue.html
Note that once you call launch from the main thread, no subsequent statements in the main method will be run until the JavaFX application shuts down. So you can't really launch from the main thread and communicate with a JavaFX app from the main thread. Instead you need to spawn another thread (or set of threads) for communication with the JavaFX app.
But really, in most cases, the best solution with concurrency is not to deal with it at all (or at least as little as possible). Write everything in JavaFX, use the JavaFX animation framework for timing related stuff and use the JavaFX concurrency utilities for times when you really need multiple thread interaction.
http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm
To get further help, you might be better off describing exactly (i.e. really specific) what you are trying to do in a new question, perhaps with a sample solution in an sscce http://sscce.org

Similar Messages

  • How to post messages between two threads other than GUI main thread?

    Does anyone have examples of post messages between two threads (other than GUI main thread)?  Would you please post the link?
    Thank you,

    Hello, you can call PostDeferredCallToThread passing the your data in callbackData parameter.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • What exactly is the diff between main window and variable window

    what exactly is the diff between main window and variable window in SAP script?

    hi,
    MAIN WINDOW :- In a main window you display text and data, which can cover several pages (flow text). As soon as a main window is completely filled with text and data, the system continues displaying the text in the main window of the next page. It automatically triggers the page break.
    You can define only have one window in a form as main window.
    The main window must have the same width on each page, but can differ in height.
    A page without main window must not call itself as next page, since this would trigger an endless loop. In such a case, the system automatically terminates after three pages.
    VARIABLE WINDOW :- The contents of variable windows is processed again for each page, on which the window appears. The system outputs only as much text as fits into the window. Text exceeding the window size is truncated; the system does not trigger a page break. Unlike constant windows, the page windows declared as variable windows may have different sizes on different form pages.
    As far as the processing of the window contents is concerned, the system currently treats constant and variable windows alike. The only difference is that constant windows have the same size throughout the form.
    hope this will be useful.
    If useful then reward points.
    with regards,
    Syed

  • Anybody help on integration between IS-RETAIL and CRM application?

    hello experts!!
    anybody help on how is the business process (or) functionality between IS-RETAIL and CRM application?
    i mean integration between IS-RETAIL and CRM application.......

    Hi Subha
    Since IS-Retail is an Industrial Solution package which was built above the Baseline package,all the Business processes which were there in 4.7 is supported by IS - Retail. You can access the Retail Menu in W10T and S000 for your normal Menu in ECC6..
    Regards
    Anis

  • Are you able to view contents of text messages between your phone and a particular phone number

    I am trying to figure out if you are able to get or view the contents of text messages between my phone and a particular phone number....aka, what we talked about. Is there any way I can do that? Any input would be helpful!!!

    Yes, look on the phone???
    I suppose you are someone of who deletes your messages on a regular basis without backing them up in any fashion which leaves you NO other way to view these messages. For future reference, if you feel you may need to review messages in the future, DON'T DELETE THEM.

  • I can't sync my all email message between macbook pro and iPad 4

    Hi,
    I can't sync my all email message between macbook pro and iPad 4. This sync only complete account setting but not email message.
    Can anybody help me to fix the problem?

    You can't "fix" this problem because you can't sync email messages from the Mac mail app, you can only sync your email account settings. Messages will not sync using iTunes.

  • N91 splitting messages between hard drive and inte...

    Hello.
    I have a lot of messages that were taking up a lot of space on the internal memory and making the phone perform sluggishly. So under Messaging > Settings > Other > Save messages, I set it to save them on the N91. However, I feel it might not be so efficient du to the hard drive usage, as I also have several mailboxes set up which I regularly check hence increased drive usage = low batery.
    However, if I then change the option to use the internal memory, messages are saved to the new location but my existing messages/mailboxes become inaccessible.
    My question is, how can I move just, say my mailboxes and thlast wee or so worth of messages to internal memory, have that used for new messages, have the older ones saved on the hard drive but still have them accessible to me?
    Thanks.
    H.
    Hussein Patwa
    PatwaNet
    Nokia 6630 on 3G (UK)
    Nokia 6610i - UNLOCKED! YAY!
    Currently looking for more cheap & new handsets - you never know when a spare can come in handy!

    Ah thanks, but that is a shame. I do of course try to keep the numbers down, but due to circumstances I have to keep records of all correspondence (it's saved me several times already).
    I do find it odd though that once you've changed the location of messages you can't see the ones in the original location even though they are still present. Is there no app or hack that can allow me to at leave move messages between the locations (and more importantly my mailboxes) to the internal memory? I suppose I could leave with changing the storage setting if I needed to look at older messages on the hard drive, but having to re-setup all the mxilboxes just because they become 'hidden' is a real pain.
    Thanks again.
    H.
    Hussein Patwa
    PatwaNet
    Nokia 6630 on 3G (UK)
    Nokia 6610i - UNLOCKED! YAY!
    Currently looking for more cheap & new handsets - you never know when a spare can come in handy!

  • Difference between database, websheet and packaged applications

    Hi,
    Can any one explain the difference between database, websheet and packaged applications?
    So far i have worked on database application and not aware of the other applications.
    Regards
    Narender B

    Narender wrote:
    Can any one explain the difference between database, websheet and packaged applications?
    So far i have worked on database application and not aware of the other applications.
    This is fully covered in the documentation:
    About Database Applications
    About Websheet Applications
    About Packaged Applications
    There is little difference between packaged applications and database applications, other than that packaged applications are supplied by Oracle and database applications are created by you.

  • Difference between Classic Planning and EPMA Application

    Hi All,
    We are currently working Hyperion Planning version 9.3.1 and we do use Classic Planning Administration. We are in the phase of upgrading to version 11.1.2 and thinking of using Enterprise Performance Management Architecture to work with applications . Kindly let me the difference between Classic Planning and EPMA Application and its cosequences on upgradation.
    Thanks in advance

    Instead of explaining it all again here are some posts around the same subject
    Re: what is the Differenc between Classic Planning and EPMA
    Hyperion Planning - Classic Administration vs EPMA ....
    Re: The advantage of using EPMA?
    EPMA compare to Classic
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to pass parameters between main and sub vi during parallel execution using the VI server technique?

    Hello All,
    I am working with the following example (from previous postings on this
    board) that demonstrates how to run a sub vi in parallel with the main
    vi.  I'd like to pass parameters between the main and sub such as
    the control (delay) and indicator (value) parameters of my subvi
    example.  Does any one know how to do this?  Parallel
    execution is important for me, I cannot just paste the subvi icon into
    my main diagram (two nested while loops...)
    Many thanks,
    Luis
    Message Edited by cascao on 08-16-2005 08:42 PM
    Message Edited by cascao on 08-16-2005 08:42 PM
    Attachments:
    VI_Server_technique.vi ‏32 KB
    SubVI_1.vi ‏19 KB

    cascao wrote:
    Hello All,
    I am working with the following example (from previous postings on this
    board) that demonstrates how to run a sub vi in parallel with the main
    vi.  I'd like to pass parameters between the main and sub such as
    the control (delay) and indicator (value) parameters of my subvi
    example.  Does any one know how to do this?  Parallel
    execution is important for me, I cannot just paste the subvi icon into
    my main diagram (two nested while loops...)
    Many thanks,
    Luis
    Luis, you can use the VI Server methods 'Set Control Value' and 'Get Control Value', as demonstrated in the attached examples.
    -Franz
    Attachments:
    VI Server.zip ‏26 KB

  • Is datasocket messaging between a network of small applications feasible?

    I want to create a number of self contained applications (exe's) that can be strung together to form a complete test solution. The exe's need to pass messages to one another in <To<From<data> format and I'd like to use datasocket as it's a  very simple interface. When To: = 'All' then the message is a broadcast to all exe's. I'm using Labview 7.1 and Windows XP. The exe's could be located on one or more machines.
    Am I likely to be successful with the following?:-
    1. A datasocket variable is created called 'message bus'
    2. Any exe can send a message to 'message bus'
    3. All exe's monitor 'message bus' for fresh data and act on it if it's addressed to themselves
    My concerns are: -
    1. What if two or more exe's send messages 'simultaneously'? Do some messages get lost?
    2. How to ensure messages are received by all exe's?
    What exe behaviour and datasocket setup might achieve the above? I'm just an EMC test manager not a programmer by trade so a bit stumped.
    Best regards, Bob Edwards

    Hi DanielHenry -
    I'll try to deal with your issues as best I can. I'm a designer too using CS3 applications the same as yourself, so have come across similar issues.
    Firstly, the display. There are many negative posts about the display on the 20inch iMac if you search these forums. The problem is that the display Apple have used has a much poorer viewing angle, hence the colour shifts you're seeing. I have a 24inch iMac at home and a 20inch iMac at work. The 24inch screen is far superior and great for graphics work. There really isn't anything you can do about the 20inch screen apart from plug in a second monitor or upgrade to a 24inch iMac.
    Secondly, I think all of the rest of your problems may be down to the 1GB of RAM you have. If you're using CS3, Quark etc then you'll have speed issues with only 1GB RAM. And that includes your Finder slowing down too. If you can, I'd recommend you buy a 4GB RAM upgrade kit from someone like Crucial [here|http://www.crucial.com/uk/index.aspx?cpe=CHAWKuk]. They are cheap and very easy to install. Just unscrew one screw, pop out the old RAM, put in the new RAM and screw the one screw back in. Easy. The instructions are [here|http://support.apple.com/kb/HT1760].
    I hope this helps.

  • Trying to pass parameters between GUI classes and methods

    Hi All.
    I have been working on a rather large final year project in college and it is getting close to the deadline. It looks as though I need to "tidy up" my code as it contains too many static methods, variables and other bad programming habits. My package consists of many different GUI's and classes. Up until now I have been calling different GUI's with guiName.NameOfMethod. I have been told this is bad practice so I am trying to fix this. Also instead of passing parameters correctly I have been creating static variables in my main class and using them. So for example if one class needed to pass a variable to the other I would first myGlobalVariable = X; in the first class. And then the second class can use this. This is also bad, right?
    So I guess im really just looking for a good example or tutorial on how to pass parameters between classes and methods, GUI if possible. Here is an example of how my GUI classes look:
    public class anotherGUI extends JFrame implements ActionListener {
            private JTextField a, b, c;
            private JButton button1, button2;
            JPanel p, p1;                   
            public anotherGUI() {
                LayOutAnotherGUI();
                setLocationRelativeTo(DnDMain.pictureArray[a]);
                setTitle("Example");
                setVisible(true);
                pack();     
            private void LayOutAnotherGUI(int c) {
         //GUI is layed out here     
            public void actionPerformed(ActionEvent e) {
                Object source = e.getSource();
                if (source == submit)
                    clickOK();
            public void clickOK(){
                //Here is where I have been accessing and modifying static global variables.  (But this needs to change).
    public void showanotherGUI() {
            new anotherGUI();
    }This is more or less how I have been going about creating my GUI's. These are used as pop ups. The user enters a value and then it is closed.
    To be honest I have been able to pass a variable correctly from one class to a GUI class but I have still having difficulty. For example in my code above I can pass the variable into this class but I cannot pass it into clickOK(). An this is where it is needed.
    Can anyone please help?
    I hope I have explained my problem well.
    Thanks in advance.

    I dont think that is what I need. An example of what I do in my program is:
    I have a main GUI with an array of images. There are a number of other small GUI's that appear for certain functions when the user clicks on an image or does some other function. I am trying to pass a value into the GUI class that is used for the smaller "pop up" GUI. So lets say the user has clicked the image in array[12]. Then a GUI is displayed. I need to pass the integer 12 into this class.
    Thanks.

  • Syncing messages between iPhone 6 and Macbook Pro

    I don't seem to be able to sync messages between my iPhone 6 and my Macbook Pro (using 10.10.1).  Trying to follow the online discussion, but left scratching my head.  Help, help.

    Hi Hawgjohn,
    The new continuity features with iOS 8 are awesome, but they do take some setup to work properly.  Luckily Apple has a big guide on how to set up all of the continuity features (including text messaging from your Mac) here: Connect your iPhone, iPad, iPod touch, and Mac using Continuity - Apple Support.
    Browse through that article and find the section that is relevant to your issue and follow the instructions

  • Relationship between NetWeaver PI and Composite Application Framework

    I am new to PI and CAF and don't understand the relationship between these technologies.  They both seem to allow users to identify and integrate application services.
    Are they complementary?  Is PI required for using CAF, or only in some instances?  Is PI only needed if the application services are coming from both SAP and Non-SAP environments?
    It would be appreciated if someone could shed some light on this for a generally non-technical person.  I keep reading the PI and CAF product literature and can't clearly see the relationship.
    thank you.
    Jonathan

    Hi
    Please go thru the below discussion,
    PI 7.1 advantages related to ESOA ? (check pushkars comment)
    about  the installation...
    Re: CAF on PI7.1 stack.
    Regards
    Ramg

  • Background displaying between main content and footer

    Hi guys, I have a bit of a strange one to ask, with a discrepancy between what I am seeing on my website (online), compared to viewing my pages in Dreamweaver.  OK, here goes.. online, the footer shows up fine, being directly underneath the main content (with nothing displaying between the footer and the main content) - however when I look at the same pages in Dreamweaver (CC), it shows a very large amount of the purplish background situated directly between the main content and the footer, and taking up an area around 4 times the height of the main content of the page (which basically makes the page 4 times bigger than it needs to be, in Dreamweaver).    I hope that description makes sense - so basically (as I scroll down the page in Dreamweaver), firstly I have the main content (taking up 20% of the total height of the page), then below that, the mystical blank area of background color (taking up  maybe around 79% of the total height), and then below that, right at the bottom, the footer (say, 1% of the total height).   Yet when I view the web pages online, the footer is sitting snugly below the main content, exactly where it is meant to be - which I guess is the important thing, but I am worried that Google will see the issue as some kind of page error, so I would prefer to fix it if I can.    Here is a typical page where the issue exists - http://www.mindtraining.net/dreamweaver/motivational-info/index.php  I have a feeling it might have something to do with the vertical blue strip I have on the right hand side of each page, as the only page where the issue doesn't exist is the homepage at http://www.mindtraining.net/dreamweaver - which doesn't have the blue strip.  Any thoughts would be greatly appreciated.  Many thanks, Craig T

    Both links are going to the same page.  So they are identical.
    <I am worried that Google will see the issue as some kind of page error>
    Google robots don't see CSS or JavaScript. They index sites based on your HTML content.
    Unfortunately, you do have a significant number of code validation errors which need attention to avoid x-browser rendering problems.
    [Invalid] Markup Validation of http://www.mindtraining.net/dreamweaver/motivational-info/index.php - W3C Mark…
    Do not use spaces in folder & file names.  On the web it creates problems b/c spaces are converted to %20.  Use underscores or hyphens but no spaces or special characters.
    Change all instances of this:
    Metamorphic Dreamweaver Template_files
    to this:
    Metamorphic-Dreamweaver-Template_files
    or this:
    Metamorphic_Dreamweaver_Template_files
    You also have some orphaned HTML tags.
    Nancy O.

Maybe you are looking for

  • Interesting Issue with Screen Saver in System Preferences

    Sorry for posting what might be a simple fix, as I thought it would be such, but apparently I just can't seem to figure this out. (as I trouble shoot for Pro Apps support requests every day at the office, but it's always the simplest items that seem

  • MSI GT683DXR - HOW TO SWITCH TO RAID?

    Hi everyone, I'm inclined to switch to RAID 0 on my MSI GT683DXR. (It's the French model but I've put an English Keyboard in). I have 2x 750GB Hard Drives inside. I would very much appreciate if somebody could guide me on how to go about the process.

  • On Value Request Problem

    When I use On Value request for sel_op_fielda, I need to validate another field in my selection screen.... ( Sel_op_fieldb-low in case of this example) It's... not working. When debbuging the Sel_opfieldb keeps comming initial. Am I forgotting someth

  • How to monitor the subsequent jobs

    Dear all, I use the LSMW interface program to upload data. Actually there are some subsequent jobs will be triggered by LSMW. How can I check these jobs? Is there any function that can find subsequent jobs based on the upper job name and job count? t

  • Zen Micro wont connect to my computor HELP

    This is the second Zen Micro that wont connect to my computer i've tried everything but nothing is working i've tried it on other computers and it still wont work. I just got this replacement today and I don't really want to go back and get another o