Question: I am developing a project using primefaces.

**Code:**

```
<p:panel id="accountPolicyRichPanel">
    <h:panelGrid id="outputPanelGrid">

         <h:outputText value=""...../>
         <p:inputText id="InputTextId"/>

        <p:selectOneMenu id="suspendTypeId" value="...">
             <f:selectItems value="#{AccountPolicy.suspendTypeItemList}"/>
             <p:ajax listener="#AccountPolicy.suspendTypeComboboxAction}"event="change" update="outputPanelGrid"/>
        </p:selectOneMenu>
   </panelGrid>

        <p:commandButton id="saveButtonId" value="..." action="..."
              update="accountPolicyRichPanel" />

</p:panel>

```

My issue is when i select the `<p:selectOneMenu>` I upadte the `<h:panelGrid id="outputPanelGrid">` at the time my previous entered value in `<p:inputText id="InputTextId"/>` is removed.

How to update the `<h:panelGrid id="outputPanelGrid">` or `<p:panel>` without remove the previous entered value in `p:inputText`.

Answer: 
You have a problem and you want to use multi-threading to solve it. Now you have two problems. :)

First of all you have to look at a way to decompose your problem into something that can be done in parallel. The way you have decomposed your problem right now is inherently sequential. There is no advantage to multi-threading when you decompose it this way because the through put will be limited by the slowest step in the process.

A better way to decompose your problem would be to break up the job into tasks that are repeatedly executed. The slowest, but also most easily parallel part is reading and uploading the files. You can do this for each file in parallel. This allows you to leverage Javas [High Level Concurrency Objects](http://docs.oracle.com/javase/tutorial/essential/concurrency/highlevel.html) which will safe you a world of pain.

Thread 1: Watch input folder for files. When a new file appears, create a task. This task is submitted to a [Task Executor](http://www.javaworld.com/article/2078809/java-concurrency/java-101-the-next-generation-java-concurrency-without-the-pain-part-1.html). The executor will then execute the task on its own thread using one of the available threads.

Task: For a given file a task reads, parses and validate the data in the file. When the data is valid write it to the database and delete/move the original file. 

Thread 2: Watch the task executor for completed tasks. When a task is complete, read its information and write a report or log an error if something went wrong.

Thread 3: Since you have tasks going on in parallel you need something to monitor user requests to stop the service gracefully. You don't want to stop the service halfway through writing a report.

Logging: Logging is a separate concern but has nothing (much) to do with threading. You should use a logging framework for this. Most frameworks can handle logging from multiple threads.

Finally note that your problem doesn't sound like a problem that would benefit much form parallel processing. Reading files, and uploading them to a database are both IO operations and IO operations are glacially slow compared to other computations. They're also the bottle neck for all parallel processes. You can't read files faster then your disk can provide them and you can't upload faster then your connection can handle. So you have to ask yourself if the marginally improved speed is worth the added complexity.
you can use Thread3.setPriority(Thread.MIN\_PRIORITY); priority is int number 1-10 1 is the minimum and 10 is the maximum