Creating a separate Thread

I need to know how to run a thread along side my GUI thread.  Right now I have a GUI application and what I need is a thread that will begin when the GUI's and accept incoming messages (in a TCP socket) and for now just display the message once it is reacieved in a window dialog in the GUI.

I already understand what I have to do with matters of decision-making, therefore, above all, my question is this: How to create a thread that A) begins when my GUI and B) can create a pop-up message in the GUI from time to time?

(the thread should also leave when the GUI closes)

If there is a screen that is always displayed when the application starts, when you start the thread of this screen, it will be little matter what screens put you in front of it (make sure you that you control the number of threads spawn you, so you create no more you need).

The other option is from your thread before entering enterEventDispatcher (I think that would work too).

Tags: BlackBerry Developers

Similar Questions

  • The main program is seen as a separate thread?

    I tried to stop a GUI based program opening too fast because the splash screen has not been seen for a long time enough.

    So I tried to use the classes Thread and can be walked in the GUI Builder.
    Trying different things, I got it to do what I wanted: a delay of 10 seconds before the GUI of the program display.
    But I don't understand why main is not considered a separate thread and continue to get visible regardless of the status of delayThread.
    // Constructor:
    // ---------------
    public Hotel (int numberIn)
        {
             // Create the time delay thread so that users may enjoy the splash !
             delayThread = new Thread(this);
             delayThread.run();
             // Initialise the number of rooms and the GuestList :        
            noOfRooms =  numberIn;
            guests  = new GuestList(noOfRooms); 
            // Graphics settings:      
            setTitle("Hotel");     
            setLayout(new FlowLayout());
           // etc. etc.
           // etc. etc.
           setVisible(true);
       }
    
    
        // A run method to delay the program opening:
         
        public void run()
        {     
             try
             {
                  delayThread.sleep(10000);
             }
             catch(InterruptedException ie)
             {
                  ie.printStackTrace();
             }
           
        }
    Now, maybe a better way to do would be to go the setVisible of the manufacturer, the run method statement.
    Maybe there's something even better to produce a delay in the opening of the program.
    But I'm still curious why the main thread has been delayed by a delay in what is really a completely separate topic.
    Any ideas?

    Published by: KonTiki on February 16, 2013 13:10

    Published by: KonTiki on February 16, 2013 13:19

    Published by: KonTiki on February 16, 2013 13:20

    Published by: KonTiki on February 16, 2013 13:21

    Published by: KonTiki on February 17, 2013 09:16

    Are you sure that show you all the relevant code? I think that, as is the case, the thread in sleep does nothing.

  • How can I create a separate address book? I'm not on a mailing list but an address book where addresses are not mixed with my usual address b

    How can I create a separate address book? I'm not on a mailing list but an address book where addresses are not mixed with my address book regularly. I already have three created for me by Thunderbird address books. Add all new addresses to one of those, I'm not afraid to remove the other address books, because some of their addresses are not repeated in my address book "main". So if I delete all the names in one of the existing books, I need to create a blank book that will not mix the addresses with those of an another address book. HOW CAN I CREATE AN ADDRESS BOOK EMPTY? I want to be able to create multiple mailing LISTS using the addresses in this new book, I will eventually have an address book special with a variety of mailing lists, that I can use as I want to.

    In the address book, file | New | Address book.

    No menu showing "file"? F10 or ALT.

  • I created a separate administrator account and can't get it to appear at startup.  I need to send my Macbook repair and need this ID to show when they turn on him. How do I do that?

    I created a separate administrator account and can't get it to appear at startup.  I need to send my Macbook repair and need this ID to show when they turn on him. How do I do that?

    If you added via the preferences system/users and groups, it should appear as a long time that you have set the display of connection to appear. To do this, go to System Preferences/security and privacy. Then check the check box turn off automatic connection . This should show the login screen at startup. You may need to click the lock (lower-left) icon to unlock the setting to check it out.

  • Several instances of VI in separate threads

    Hello

    I am trying to run two instances of the same VI (with separate sequence contexts) in two separate threads. These two instances are called from two separate sequences, using a new thread for each sequence. The problem is that the instance of the VI called from the second sequence does not run as long as one has stopped. I need help to make them run in parallel, they should not be waiting for each other to finish.

    Thank you

    Chris

    Chris,

    the VI itself is executed by the runtime of LV. Therefore, if the VI is not reentrant, it will block all calls, regardless of the calls threads, if it is already running.

    According to the content of this VI, the most obvious solution is to set the "returning" VI

    Norbert

  • When you try to create the new thread in a discussion forum, the browser closes and I'm back in the office.

    I tried to create a new thread in a Discussion forum.  Closing the browser window and I was back on the desktop.  I did a system restore, which not only does not solve the problem, but deleted my internet security software.  Has worked with people of tendency to reinstall the software, but I get a message tht says: «Unable to extract the installer...» ».  I have a class of the internet this week and I need this computer.  Can someone please?

    You can undo the last restoration of the system using: http://www.vistax64.com/tutorials/76256-system-restore-undo.html.  This may fix your problem with security software that has uninstalled when you did the system restore (using a date that probably existed before the installation of trend).  I don't know if it works now that you have done other things to try to reinstate the program, but it's worth a try.  I sincerely doubt that this process could help with the problem of browser (and there not so undo it reverses your efforts).

    You use Internet Explorer?  If so, please repost your question in Forum Internet Explorer: http://social.answers.microsoft.com/Forums/en-US/InternetExplorer/threads where the IE specialists will be more than happy to help you with your problem.

    If you are using another brand of browser, please repost your question in the Forum program: http://social.answers.microsoft.com/Forums/en-US/vistaprograms/threads where experts in programs other than Vista or IE will be more than happy to help you with your problem.  You can also try to go to the web site of the Explorer and contacting their technical support staff (or post on a forum if they support a).

    Only trend can help you with installation problems you encounter through their program.  Perhaps it didn't uninstall completely during the restoration of the system.  Check if the trend has a removal tool and use it to uninstall the program, then try to re - install again.  If this does not work, you will need to work with their technical support to solve the problem.

    I hope this helps.

    Good luck. Lorien - a - MCSE/MCSA/network + / A +.

  • Create a background thread to consume a webervice and invalidate Manager to refresh the screen

    Hello

    I create an application that uses Web services to place objects on a VerticalFieldManager with the received information. What I'm trying to do is first tap on the screen and then consuming the Web service on the merits in order to refresh the screen while he receives the info. Right now my app uses the webservice from the preview screen, but it doesn't push the following until he finished consuming the WS.

    I read that you can create a background thread, and then syinchronize with the user interface refresh (invalidate()) screen, but I don't have all the tracks of where to start. Can someone help me please? Including creating a background thread?

    Thank you very much!

    The best way for your background screw to change your user interface within the constraints of the

    UiApplication.getUiApplication().invokeLater(new Runnable()
    {
        public void run()
        {
                     //your UI modifying code here
            }
    });
    
  • What better union all or create a separate slider

    Hi gurus

    I wonder if someone can help out me of this union is a good option, or create a separate slider for each union all is a good option. Which is preferable? Thanks in advance

    Concerning

    Shu

    You can use Union all instead of opening cursor much time to record the line and your code in the treatment of the sliders, exceptions.

    So it would be better to consider all the data at once and even within a single processing loop.

    Kind regards

    Prashant da Silva

  • A pdf with two images page. How can I create a separate pdf for each image?

    I was sent a scan of two images using Adobe Acrobat DC A4.  The images are invoices.  I want to create two separate pdfs, one for each Bill, so that I can drop off each invoice with the operation seen in my accounting software.  If possible, please let me know how to go on this issue. Thank you.

    If the two images are on the same page: duplicate page (drag / move in the Pages panel while holding the Ctrl key).

    Then crops the first page to only show that the first Bill and the second page to show only the other. Then extract each page as a new file.

    If the image is on a separate page: extract each page as a new file (via Tools - Pages - extract Pages).

  • How can I create a separate page in the menu bar?

    How can I create a separate page in the menu bar?

    I want to create a page that does not contain the bar, other pages, and I don't want other pages to include this new page in their menu bars.

    I want to create a different page (s) completely independent in an existing menu bar and maybe add it's own menu bar...

    Is there a way to do it?

    Yes, you can right click the page you want to have separate and select "exclude of the Menu.

  • Offset path does not create a separate path

    CS6 Mac

    Looks like my Illustrator is listening outside. When I apply offset path of the compound object, Illustrator does not create a separate path for me, but both the offset and original sort to group together:

    https://www.dropbox.com/s/xiu3xqcictx0ku0/Offset_problem_1.PNG

    I am trying to create an effect like this tutorial on youtube. But as the offset path does not create a separate path, I can't duplicate the same effect.

    No idea on how to solve this problem would be appreciated.

    Did you use the object > path or effect > path? Here is the difference

  • Where is 'Create a separate record for each volume' past? in VMware-converter - 4.0.1 - 161434.

    Where is 'Create a separate record for each volume' past? in VMware-converter - 4.0.1 - 161434 (independent). Option is not more than 4 converter?

    Hello.

    When you get to the third tab called "View/Edit Options", choose the Edit option for 'Data to copy.'  Then choose the option advanced at the end of the menu "data copy type" and then use the options on the page layout tab target to assign separate discs.

    Good luck!

  • Cannot create new native thread

    What causes this?

    oracle.odi.runtime.agent.invocation.InvocationException: ODI-1274: Agent Exception caused by: failed to create new native thread
    at oracle.odi.runtime.agent.invocation.RemoteRuntimeAgentInvoker.invoke(RemoteRuntimeAgentInvoker.java:260)
    at oracle.odi.runtime.agent.invocation.support.InternalRemoteRuntimeAgentInvoker.invokeStartScenario(InternalRemoteRuntimeAgentInvoker.java:162)
    at oracle.odi.runtime.agent.invocation.support.InternalRemoteRuntimeAgentInvoker.invokeStartScenario(InternalRemoteRuntimeAgentInvoker.java:129)
    at com.sunopsis.dwg.tools.StartScen.actionExecute(StartScen.java:268)
    at com.sunopsis.dwg.function.SnpsFunctionBaseRepositoryConnected.execute(SnpsFunctionBaseRepositoryConnected.java:162)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java:3430)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeOdiCommand(SnpSessTaskSql.java:1491)
    at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:32)
    at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:1)
    at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:537)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1595)
    to oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$ 2.doAction(StartScenRequestProcessor.java:580)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
    at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor.doProcessStartScenTask(StartScenRequestProcessor.java:513)
    to oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$ StartScenTask.doExecute (StartScenRequestProcessor.java:1070)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 1.run(DefaultAgentTaskExecutor.java:49)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor.executeAgentTask(DefaultAgentTaskExecutor.java:41)
    at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.doExecuteAgentTask(TaskExecutorAgentRequestProcessor.java:92)
    at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.process(TaskExecutorAgentRequestProcessor.java:83)
    at oracle.odi.runtime.agent.support.DefaultRuntimeAgent.execute(DefaultRuntimeAgent.java:68)
    at oracle.odi.runtime.agent.servlet.AgentServlet.processRequest(AgentServlet.java:445)
    at oracle.odi.runtime.agent.servlet.AgentServlet.doPost(AgentServlet.java:394)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
    to org.mortbay.jetty.HttpConnection$ RequestHandler.content (HttpConnection.java:879)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    to org.mortbay.jetty.bio.SocketConnector$ Connection.run (SocketConnector.java:228)
    to org.mortbay.thread.QueuedThreadPool$ PoolThread.run (QueuedThreadPool.java:520)

    Please check in the Metalink if you can find a solution for this issue.
    If you want to dig deeper enable agent tracing and capture more detailed logs and see if that helps.

  • When to create a separate server for JMS

    Gurus
    Please provide/point of guidelines when creating a separate JMS server within the Weblogic 11 g server, the pros and cons of doing the same thing.

    Guide to Oracle Weblogic JMS, the main value add I am able to see is the separate persistent store and a separate logical container for the JMS resources related to my project. These will be significant value-added since we will use a shared environment where objects from several projects will be deployed.

    I did research online, but could not do more entries. Appreciate the pointers.

    concerning
    Basu

    There is a Server JMS and Persistent Store section in the book of JMS configuration best practices.
    http://docs.Oracle.com/CD/E17904_01/Web.1111/e13738/best_practice.htm#CACGFHDJ

    Hope it will be useful to you.

  • Why Dev Guide says 'create a separate project for each workflow to ADF... '. »

    Hello

    We have a process BPM application that is having some human tasks. Form for each of the human tasks is similar. We would like to share some fragments of page or code between them and create unique web application to manage all human tasks for this application of BPM process. Then, I found the following in the document Oracle "Oracle SOA Suite 11 g Release 1 (11.1.1.4.0) Developer Guide":

    "If the composite SOA contains several human tasks, create a separate project for each ADF workflow associated with each human task."

    I wonder if we have to do and if so, what is the reason.

    Do you have any idea? Help, please.


    Thank you very much

    Helen

    Hi Helen
    1. I don't know the reason why they mentioned as separate project for each human task. NO, this is not necessary and we can have a single project of UI as MyTaskForms and have all JSPS in this same project for each human task.

    2. for our part, we have like 10 human tasks, while using the same payload. We have therefore 10 .task file. For the first file .task, we Auto generate project and gave the name of the project as OurAppTaskForms. Is the reason why as we did, for he adds all dependent libraries required, tag libs etc correctly. For all other .tasks files 9, we did NOT use auto generate. Instead we used standard New-> JSF human task and select only one task at a time and follow the steps. These steps are covered in the online documentation. At the end in our BPM application, we have just a UI project with all 10 screens.

    3. in ADDITION, all 10 screens have some common data. We put in a reusable JSF Fragment page. And associated with a managed Bean for this set and get the values of this fragment and also certain Actions for a few buttons in the Joint Strike Fighter. Then, we have included this JSF in every file of jsf taskform, uisng the tag include. We have added the include tag, somewhere in the upper part. If all the screens share common page fragment of jsf.

    4. we can refine the above things further. As per above, we have again JSF 10 screens for each one of the .tasks 10. Of course all these 10 jsf have same common jsf fragment. BUT instead of 10 screens individual jsf, we can have only ONE screen of Jsf also. For details, see the docs online. The hard part is, we don't have that one jsf, there may be a few tricks of bussiness, validatoin stuff to take care of in Manager ValidationCallback custom classes. Say for Task1, had to show some buttons, but NOT for Task2. So, we have to manage this logic. Also validation callback, we can always get each task, title also. So that we can get around this problem too. We are in the process of doing now. But first of all 3, we did it before and they work very well.

    My personal suggestion is to first go with jsf one fragment and include all duties jsp files. Any changes made to the common elements need only put in one place IE page fragment.

    Thank you
    Ravi Jegga

Maybe you are looking for

  • cannot get menu local folders to display

    8.1 thunderbird 31 victory. All normal except cannot access the 'Local Folders' menu located on the left side of the screen on another XP computer.In fact can not find "Sent", which is what I really want.Thank you.Jim

  • Apple music does not work with Audirvana

    My Mac Pro is Os X 10.9.5. I listen to music through audiolab and my Dac is M2Tech highface evo. Audirvana has no interface with Apple music. Can someone help me to do the work of audirvana with Apple music?

  • Labelling of a backup CD

    I have Windows Vista and the automatic backup set. I have the backup set to my reader of CD E. When the backup starts, it stops and asks a disc with a label how to label a disk? I tried to format a blank disc again 3 times and after formatting, none

  • Scanning multiple pages with Windows Fax and Scan

    I can't understand how to scan multiple pages in a document on Windows 7 using the Windows Fax and Scan program. Using the same printer (Canon MX300), I can scan in several pages in a single file on my old XP using Windows Office Document Imaging. It

  • I need to give a file a few extra GB, how can I do this?

    I need to givea folder two GB of extra space how do I do this?