Different type of threads?

Dear,
Is it we should use different methods to invoke the threads for different purposes? eg. use swingworker class to start time comsuming task...; use invokelater() to start a thread which used to alert the GUI... is it true?

hi,
Swing components are not Thread-safe, what this means is that the components can be accessed only from a single thread at a time (Generally the event-dispatching thread) after they have been realized, there are certain methods though that are gauranteed to be thread-safe (like paint, thread-safe methods are marked out in the API ref).
herez the golden rule:
Once a Swing component has been realized, all code that might affect or depend on the state of that component should be executed in the event-dispatching thread.
A component becomes realized if itz paint method is going to be called or has been called.
Event-Dispatching thread is the thread which handles the event-handling code..
Now if the task at hand is going to take up a lot of time u should not do it in the event-dispatching thread, you should in turn do it in a separate thread.. but letz say the results of the operation require u to update a gui, u cannot update the gui from that thread (non event-dispatching thread) , for updating the gui you would use the SwingUtilities.invokeLater or SwingUtilities.invokeAndWait methods. SwingWorker is a separate Class (not part of jdk) that can be downloaded from the sun site at
http://java.sun.com/products/jfc/tsc/articles/threads/src/SwingWorker.java
the idea of this class is that it eases the task of the programmer who has to create new threads that will take up time to execute, this class provides a mechanism to start a thread to perform a task that will take time, also after the task is over it automatically calls a method (finished()) in which you can then do whatever is required with the result (for eg update the gui using the result in a event-dispatching thread using the SwingUtilities.invokeAndWait())..
for eg If you are doing IO operations that are going to take time you could use the SwingWorker like
SwingWorker worker = new SwingWorker()
   public Object construct()  //method defined in swingwoker which is to be overridden
          return myMethod(); //myMethod returns a object after taking lotz of time letz say..     
   public void finished()   //method is automatically invoked by swingwoker after myMethod finishes.
        Object obj = get();  // get() returns the value returned by myMethod();
worker.start();now letz say you are doing some task in a non-event dispatching thread and you want to update the gui (you should not directly do it from that thread as it can lead to problems) you would do it using the SwingUtilities.invokeLater or SwingUtilities.invokeAndWait
eg
  Runnable myRunnable = new  Runnable()
        public void run()
             //update the gui here
    SwingUtilities.invokeAndWait(myRunnable);the invokeAndWait method blocks whereas the invokeLater does not (so itz preferable to use this !!)..
hope that helpzz
cheerz
ynkrish

Similar Messages

  • Different types of mapping techics

    hi expects,
       please provide some mapping technics.

    Rohit,
    It depends upon the requirements. So after going through your requirements you will decide which type of mapping you want to use. Subsequently you will develop the mapping.
    Check this threads for different types of mappings and their advantages and disadvantages:
    Differences between the Mapping types.
    Re: Types of Mappings and their Use
    ---Satish

  • Display different types of file formats from contents server on web UI

    Hi,
    I have to read different types of documents from content server and display it in web page using webdynpro abap.
    Different types of documents are : Tif, Jpeg, BMP, PNG etc. need to be convert into gif format and display
    Txt files as it is.
    PDF files as it is.
    Microsoft office documents as it is.
    ALF files i.e. printlists to be shown on web page.
    Please anyone has any information regarding this let me know ASAP.
    Thanks & Regards,
    Manali

    hi ,
    pls refer the below thread :
    Dynamic Use of Mime in component
    n check wid thomas reply in the thread :
    Create the cached response object that we will insert the  content
    Well you can manipulate the MIME content at runtime by using the API: CL_MIME_REPOSITORY_API. However if your content is temporary, it is more efficient to just place the content directly into the ICM cache. You don't have the overhead of having to both write and then delete it from the database. Here is an example of how you can do this:
    I hope it wud be helpful
    rgds,
    amit

  • The workflow could not update the item, possibly because one or more columns for the item require a different type of information. Outcome: Unknown Error

    Received this error (The workflow could not update the item, possibly because one or more columns for the item require a different type of information.) recently on a workflow that was
    working fine and no changes were made to the workflow.
    I have tried a few suggestions, i.e. adding a pause before any ‘Update’ action (which didn’t help because the workflow past this action without incident); checked the data type being written
    to the fields (the correct data types are being written); and we even checked the list schema to ensure the list names and the internal names are aligned (they
    are), but we still cannot figure out why the workflow is still throwing this error.
    We located the area within the workflow step where it is failing and we inserted a logging action to determine if the workflow would execute the logging action but it did not, but wrote the same error message.
    The workflow is a Reusable Approval workflow designed in SharePoint Designer 2010 and attached to a content type. 
    The form associated with the list was modified in InfoPath 2010. 
    Approvers would provide their approval in the InfoPath form which is then read by the workflow.
    Side note - items created after the workflow throws this Unknown Error some seem to be working fine. 
    We have deleted the item in question and re-added it with no effect. 
    Based on what we were able to determine there don’t seem to be any consistency with how this issue is behaving.
    Any suggestions on how to further investigate this issue in order to find the root cause would be greatly appreciated?
    Cheers

    Hi,
    I understand that the reusable workflow doesn’t work properly now. Have you tried to remove the Update list item action to see whether the workflow can run without issue?
    If the workflow runs perfectly when the Update list item action is removed, then you need to check whether there are errors in the update action. Check whether the values have been changed.
    Thanks,
    Entan Ming
    Entan Ming
    TechNet Community Support

  • The workflow could not update the item, possibly because one or more columns for the item require a different type of information using Update Item action

       I got error  "The workflow could not update the item, possibly because one or more columns for the item require a different type of information "I  found out the cause is  Update Item action       
    I need to update item in another List call Customer Report ,the field call "Issues"  with data type  "Choice"   to yes
    then the error arise .   please help..

    Thanks for the quick response Nikhil.
    Our SPF 2010 server is relatively small to many setups I am sure. The list with the issue only has 4456 items and there are a few associated lists, eg lookups, Tasks, etc see below for count.
    Site Lists
    Engagements = 4456 (Errors on this list, primary list for activity)
    Tasks = 7711  (All workflow tasks from all site lists)
    Clients = 4396  (Lookup from Engagements, Tslips, etc)
    Workflow History = 584930 (I periodically run a cleanup on this and try to keep it under 400k)
    Tslips = 3522 (Engagements list can create items here, but overall not much interaction between lists)
    A few other lists that are used by workflows to lookup associations that are fairly static and under 50 items, eg "Parters Admin" used to lookup a partners executive admin to assign a task.
    Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.

  • Mini-DVI to DVI Adapter issues (2 different types, no info from Apple)

    as you can see below, I have an iBook G4 1.2GHz
    three weeks ago I got a Mini-DVI to Video Adapter
    there were two different types in the Apple Store because there are two generations of Mini-DVI outputs, therefore some close inspection and it was easy to get the right part.
    Now, three weeks later, all that stuff is off the shelf so it looks like they only have up the more recent size plug. Thus, I cannot find the slightly smaller Mini-DVI to DVI Adapter. (typical Apple, probably just wants me to spend more money on a new machine)
    Anyone have a line on where to buy the older type of adapter?
    be very careful out there. They are pimping the heck out of the newer generations. I'm looking for the older one.
    (if not, I'll probably just stop buying Apple stuff. No need for the headache any more since they are no longer really different products. Just fashion)

    I have both an iBook G4 and a MacBook, which use each of the adaptors you have described. I found the information on the Apple site by identifying the Model iBook I had, Dual USB, and looking at he detailed views of each model to identify the type of 'video output port'. I obtained a '2 input' VGA switch from Tiger Direct to be able to switch my monitor from iBook to MacBook.
    Hope this helps!

  • Convert different types of files and merged them into one pdf

    Hi, everyone. I'm girl from China.
    There is folder containing severl files of different types, like doc, msg, jpeg etc.   And I want to convert and merge them into one pdf following a certain order. I know that PDFmaker can do that nicely, but the problem is that I have like 3000+ fodlders that requires the same work.
    I want to do it with VBA and Acrobat. I have a Acrobat XI Standard Version and a perfect license, by the way
    And I have got the code(Thanks, Karl Heinz Kremer) of merging two pdfs into one, but how can I convert them into pdf first?
    Thank you very much.
    If I can finish this, I would like to publish my code on this forum.

    Wow, that's great news. But how should I add the Action?
    1. There is no action named "Covert files into Pdf" in the tools panel....
    And if I write Javascript code to do this action. How should I write it?
    app.openDoc({
    cPath: "/c/temp/myPic.jpg",
    bUseConv: true
    These code only works when I specify the path of the file.
    If you know how, pls tell me..........

  • How can I get the program to recognize two different types of thermocouples?

    I am using a PCI-4351 card with a TBX-68T terminal block. I was having trouble writing and finding a program that would give me more than one reading/sec. I found a program on the NI website called "435x_logger_triggering", and so far it is the only program that I have found that will actually collect data at 60 Hz. Unfortunately, this program only lets you specify one mode for your thermocouples. This is a problem because we are using two thermocouples, one is type K and the other is a type R, so we get bad readings from one of the thermocouples depending on which mode it is set on. I would like to know how I can program in a seperate mode for each channel in this program. Un
    fortunately, some of the sub VI's in this program are password protected, so I don't know if this is possible. Everything is entered correctly in the Measurement and Automation explorer, so that isn't the problem. I will attach a copy of the program that I am using. I have modified it slightly from the one I got off the NI website, so that the thermocouple readings have a time stamp and are saved to disk. Any assistance you could give me would be greatly appreciated.
    Thanks,
    Jordan
    Attachments:
    Forest_Fire_Thermocouple.vi ‏140 KB
    435xlogger_triggering.vi ‏110 KB

    Jordan,
    You should be able to sample two different thermocouples in the example that ships with the 435x driver called "Getting Started with multiple tranducers Continous". Simply put each type of thermocouple in a different index . Each index of the Transducer Group Array can have a different type and specify the channels that correspond to that type.
    One way that you can speed this VI up is to place a wait inside of the while loop. This will reduce the number of times the software polls the card if it has available data(increasing the overhead). I would suggest about 500 ms. The data that you receive will all have the same delta t because the sampling clock is hardware driven not software, so it does matter when the data is polled.
    You will not be
    able to get 60 samples per second when you are measuring multiple channels anyway. The sample rate for multiple channels is about 9/(# channels). This is explained in the 435x Users Manual.
    I looked at your code and noticed that you tried to change some of the enumeration controls. Unfortunately you will not be able to change these because they are password protected on the low level subVIs, which is where they are defined.
    The way you select if you want the notch filter is in the 435x Config you specify fast or slow. If it is slow then it will select 10Hz as the nitch filter. If you select fast the it will select either 50 or 60Hz You would then use the function "435x Set power line frequency"
    Good luck,
    Mike

  • What are the different types of analytic techniques possible in SAP HANA with the examples?

    Hello Gurus,
    Please provide the information on what are the different types of Analytic techniques possible in SAP HANA with examples.
    I would want to know in category of Predictive analysis ,Advance statistical analysis ,segmentation analysis ,data reduction techniques and forecast techniques
    Which Analytic techniques are possible in SAP HANA?
    Thanks and Regards
    Sushma C Narasimhamurthy

    Hi Sushma,
    You can download the user guide here:
    http://www.google.com.au/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CFcQFjAB&url=http%3A%2F%2Fhelp.sap.com%2Fbusinessobject%2Fproduct_guides%2FSBOpa10%2Fen%2Fpa_user_en.pdf&ei=NMgHUOOtIcSziQfqupyeBA&usg=AFQjCNG10eovyZvNOJneT-l6J7fk0KMQ1Q&sig2=l56CSxtyr_heE1WlhfTdZQ
    It has a list of the algorithms, which are pretty disappointing, I must say. No Random Forests? No ensembling methods? Given that it's using R algorithms, I must say this is a missed opportunity to beat products like SPSS and SAS at their own game. If SAP were to include this functionality, they would be the only BI vendor capable of having a serious predictive tool integrated with the rest of the platform.... but this looks pretty weak.
    I can only hope a later release will remedy this - or maybe the SDK will allow me to create what I need.
    As things stand, I could built a random forest using this tool, but I would have to use a lot of hardcoded SQL to make it happen. And if I wanted to go down that road, I could use the algorithms that come with the Microsoft/Oracle software.
    Please let me be wrong........

  • What are the different types of bind that we can use to configure COREid?

    Hi
    What are the different types of LDAP bind that we can use to configure COREid?
    Thanks for your input.

    (http://download-west.oracle.com/docs/cd/B28196_01/idmanage.1014/b25343/idconfig.htm#BABGAECB)
    7.5.2 Creating an LDAP Directory Server Profile

  • What are the different types of Wage types for Indian Payroll...??

    Dear Frnds,
    What are the different types of Wage types for Indian Payroll that we have to configure it...?? and please list wage types that we have to configure it for different types of TAX and Allowances in India payroll.
    And also please list Info types numbers for different types of TAX and Allowances.
    Many thanks in advance.
    Regards
    Ahmed.

    for the list of the wage types you can check V_512W_D for country grouping 40 Inida
    for Tax related info please search the forum or search google you will get lot of inputs

  • What are the different types of exits available?

    hi all,
    Can any explain different types of exits ? user exit ? menu exit etc?
    can anyone explain me each exit with an real time scenario
    regds
    hari

    <b>Types of Exits  </b>
    There are several different types of user exits. Each of these exits acts as hooks where you can attach or "hang" your own add-ons.
    <b>Menu Exits </b>
    Menu exits add items to the pulldown menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications.
    SAP creates menu exits by defining special menu items in the Menu Painter. These special entries have function codes that begin with "+" (a plus sign). You specify the menu item’s text when activating the item in an add-on project.
    <b>Screen Exits</b>
    Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screen’s flow logic.
    <b>Function Module Exits</b> 
    Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits. 
    When you add a new menu item to a standard pull down menu, you use a function module exit to define the actions that should take place once your menu is activated. 
    Function module exits also control the data flow between standard programs and screen exit fields. SAP application developers create function module exits by writing calls to customer functions into the source code of standard R/3 programs. 
    These calls have the following syntax: 
    CALL CUSTOMER-FUNCTION ‘001’.
    <b>Field Exits </b>
    Field exits allow you to create your own programming logic for any data element in the Dictionary. You can use this logic to carry out checks, conversions, or business-related processing for any screen field.  Example: The data element BBBNR identifies a company’s international location number. You might want to set up your R/3 System so that all international location numbers are larger than 100. 
    The field exit concept lets you create a special function module that contains this logic. 
    You assign the special function module to the data element BBBNR. You then assign the module to any programs and screens in which users can add new international location numbers. When you activate your field exit, the system automatically triggers your special routine whenever a user enters a company location number. 
    In 4.6c, you can use "RSMODPRF" program to create field exits.
    An example of a user exits :-
    MODULE user_exit_0001 INPUT 
        CASE okcode.
            WHEN 'BACK OR EXIT'.
                CASE sy-dynnr.
                        WHEN '100'.
                             SET SCREEN 0.
                             LEAVE SCREEN.
                        WHEN '200'.
    Note that you can write any code that satisfy your needs.                                                     ****
    But in this case, this was wrote as a sample code for reference sake.                                    ****
    And you can test it.                                                                                ****
                             SET SCREEN 100.
                             LEAVE SCREEN.
                 ENDCASE.
          ENDCASE. 
    Regards,
    Pavan

  • What are the different types of parameters available in function builder an

    What are the different types of parameters available in function builder and where do we use them.

    The different type of parameters available in FM are
    Import - They are used to pass the values to the function module.
    Export- They are used by FM to pass the result back to the calling program.
    Changing - The variables are passed to the FM and can be changed during the FM processing.
    Tables - Internal tables can be passed to the FM (it works similar to changing parameter).

  • What are the different type of projects

    i mean how many different type of projects are there in sap implementation..
    what do you mean by,
    enhancement project
    rollout project
    development project
    support project
    is there any thing else other than this?
    please clear my doubt.
    points would be rewarded.
    thank you.

    Check the link:
    http://help.sap.com/saphelp_sm40/helpdata/en/ba/38c93a37c59122e10000000a114084/content.htm
    Implementation Project
    Project to implement business processes in an SAP landscape.
    Create a project structure from the business processes. You can either create a new project structure, or base it on one of the following:
    One or more user or partner templates
    An existing project
    Scenarios and configuration structures delivered by SAP 
    An existing production solution landscape
    Template Project
    A project to create a template.
    A template makes your project structure, or parts of it, with its assigned objects (documentation, test cases, IMG activities), available to other projects.
    You can lock templates, completely or partially, against changes when they are used in other projects. To use templates in other systems, transport them.
    Template projects are especially suited to SAP partner solutions or global rollout.
    Upgrade Project
    A project to upgrade existing systems.
    In an upgrade project you can:
    Upgrade customizing: Upgrade existing functions
    and/or
    Delta customizing: Copy additional functions
    Optimization project
    A project to optimize the flow of business processes, or the use of a software solution.
    You can use optimization projects, for example, in SAP Services.
    Safeguarding project
    A project to resolve a critical situation in the implementation or use of an SAP solution.
    Safeguarding projects show the reasons for a critical situation and coordinate the steps required to resolve the problems.
    Maintenance project
    A project to maintain a solution
    in Change Request Management. The project contains all maintenance activities and urgent corrections of a solution.
    in Check-In/Check-Out Business Processes from the Solution Directory
    Regards
    Edited by: Sravan Prakash.V on Dec 28, 2007 12:25 PM

  • What are the different type of transformations in ODI?

    Hi all,
    I'm new to ODI tool.My source is Flat files and target is Teradata.Please tell me what are the knowledge modules i have to use?
    In ODI tool what are the different types of transformatios are there.Advance thanks
    Regards
    suresh

    Hi,
    Check the following KMs
    LKM File to Teradata
    IKM File to Teradata
    ODI have some basic transformation like Joiner, Filter etc .
    You can refer the User Guide for details about these transformations .
    Thanks,
    Sutirtha

Maybe you are looking for

  • Absence quota prorate by monthly basis

    Hi Experts, I have an issue regarding the absence quota for the new joiner or leaver. My client wants the leave earned to be given upon completion of the month. My current configuration is base on calendar days. For example, when a new joiner join th

  • Unable to install DB 11.2.0.1 on Linux.

    Hi, I am trying to install Oracle Database 11.2.0.1 on Linux. Below are install setups path saved. vishwa@ubuntu:/tmp/orclDisk1$ pwd /tmp/orclDisk1 vishwa@ubuntu:/tmp/orclDisk1$ ls Disk1  Disk2 vishwa@ubuntu:/tmp/orclDisk1/Disk1$ ls doc  install  res

  • Can I find a site's IP address in Firefox?

    1. If I am connected to a website and would like to find the resolved IP address, how do I do that? I know that I can use commands such as tracert in a terminal window, but I would prefer to find the IP address Firefox just used to get to the webpage

  • Display total dmbtr according to mat type and month wise

    hi all, i want to display total dmbtr according to mat type and month wise. like month       mat.type  total_dmbtr jan 2008   fert           xxxxxxxxxx jan 2008   mcfe         yyyyyyyy feb 2008  fert  mmmmm

  • Return(inbound delivery) creation through VL01N

    Hello, I wud like to create Return(Inbound) delivery through VL01N transaction. Following is the process i' m following. 1. create notification through IW51 2. create repair order through IW52 3.create return delivery ( automatically) through VL01N w