Problema com thread

1 resposta
A

Ola pessoa
em todas as tentativas
a thread thread ficava travadando ou gerava
alguma exceçao;
algum poderia me ajudar?

public void ler(){  
         text = new StringBuffer();  
 //        String arq = lerArquivo();  
         Object o = new Object();  
         conexao con = new conexao(o);          
         con.start();   
         lido = false;  
         synchronized (o) {  
            while (! lido){   
                 try {  
                     o.wait();  
                 } catch (InterruptedException ex) {  
                     //ex.printStackTrace();  
                     System.out.println(ex.getMessage());  
                 }  
            }  
         }  
   
         String arq = text.toString();  
         ...  
   }

1 Resposta

ViniGodoy

O que você quer fazer?

Como você pretende dar um notify naquele wait, se o objeto “o” é um objeto local?

Criado 7 de outubro de 2009
Ultima resposta 7 de out. de 2009
Respostas 1
Participantes 2