Android: java.lang.IllegalMonitorStateException: object not locked by thread before wait() -


i have this code android stuck @ synchronized statement. if remove process1.wait() catch exception.any appreciated?

 private class longoperation extends asynctask<string, void, string>    {        @override       protected string doinbackground(string... params)       {          try          {      process process1 = new processbuilder("sh", "/data/local/bin/tcpdump.sh").start();                         synchronized(process1){                process1.wait();              }          }          catch (exception e)          {             log.e("tcpdump function error", "unable capture packets buffer");          }          return null;       }        /* (non-javadoc)        * @see android.os.asynctask#onpostexecute(java.lang.object)        */       @override       protected void onpostexecute(string result)       {          try          {               stringbuffer output = new stringbuffer();             file file = new file("/data/local/bin/dump.txt");             bufferedreader br = new bufferedreader(new filereader(file), 8 * 1024);             string line;             while ((line = br.readline()) != null)             {                output.append(line + "\n");             }             tv.settext(output);             setcontentview(tv);          }          catch (exception e)          {             e.printstacktrace();          }       }        /* (non-javadoc)       * @see android.os.asynctask#onprogressupdate(progress[])       */      @override      protected void onprogressupdate(void... values)       {        } } 

the tcpdump.sh has line tcpdump -c 10 > /data/local/bin/dump.txt

surely meaning call process.waitfor()? not wait()?


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -