Hi Martin,

I originally had the List as an instance variable for the Page but when I
would open a new browser tab, the original page would crash and a
nullpointerException would be given because the page reference lost
reference to the object. 

So now I create in the page constructor in instance of BatchLines and pass
it along through method parameters. 

The thread is started from a method called in the constructor. Here is the
def of this method:

        /****************************************************
         * Method: beginProcessing
         * 
         * Invokes workerThreads 
         * 
         * returns: void
     ****************************************************/
        private void beginProcessing(List batchLines)
        {
          fullReportDwnLoadBtn.setVisible(false);
          
          try
          {
                  csvFileCreater = new CSVFileCreater(LOADER_CSV_FILE_NAME);
                  if(turnOnLoader)
                  {
                        BatchLoaderProcessingThread threadJob = new
BatchLoaderProcessingThread(stringList, batchLines);
                loggerThread = new Thread(threadJob);
                loggerThread.start();
                  }
                  else
                  {
                        BatchDeleteProcessingThread deleterThreadJob = new
BatchDeleteProcessingThread(stringList, batchLines);
                loggerThread = new Thread(deleterThreadJob);
                loggerThread.start(); 
                  }
          } catch (IOException e)
          {
                // TODO Auto-generated catch block
                        log.error("Inside beginProcessing() throws error: " + 
e.toString());
                        BatchProcessPage.this.error("An error has occurred 
starting creation of
CSV file");
          }
        }

Here is the definition of the thread class:

    class BatchLoaderProcessingThread implements Runnable
    {
        List stringList;
        List batchLines;
        public BatchLoaderProcessingThread(List stringList, List batchLines) 
        {
                this.batchLines = batchLines;
                this.stringList = stringList;
        }
        
                @Override
                public void run()
                {
                        processLine(stringList, batchLines);
                        loaderFinished();
                }       
    }   


processLine is a method that is part of the Page class. 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Issue-on-multi-threaded-page-when-opening-another-tab-in-browser-tp4664552p4664570.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to