Pessoal, alguém poderia me ajudar a entender essa
classe ?

Obrigado
Kleber Rodrigo de Carvalho

import java.sql.*;
import java.util.*;
import java.io.*;

class DBPool implements java.io.Serializable{
        
    /**
         * Fields containing sensitive data should not be
serialized; 
         * doing so exposes their values to any party with
access to the serialization stream. 
         * There are several methods for preventing a field
from being serialized:
     * Declare the field as private transient. 
         */
    private transient Stack cola = null;
    
    
    public DBPool(){
        LogFile.log("creando el DB pool",4);
        cola = new Stack();
    }
    
    public synchronized Connection popDBConnection(){
        Connection conn = null;
       /**
        * Faz enquanto a pilha está vazia
        */
        while(cola.isEmpty()){
            try{
                wait();
            }
            catch(InterruptedException i){
            }
        }
        
        /**
         * Remove o objeto do top desta pilha e
retorna este objeto para esta função.
         * Faz um casting deste objeto para conn
         */
        conn = (Connection )cola.pop();
        return conn;
    }
    


        /**
         * @param   r  : Nome da conexão
         */
    public synchronized void
pushDBConnection(Connection r){
        /**
         * push(Object item) 
         * Impulsiona um item para o topo desta pilha
         */
        cola.push(r);
        this.notifyAll();
    }
}

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

------------------------------ LISTA SOUJAVA ---------------------------- 
http://www.soujava.org.br  -  Sociedade de Usuários Java da Sucesu-SP 
dúvidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
historico: http://www.mail-archive.com/java-list%40soujava.org.br
para sair da lista: envie email para [EMAIL PROTECTED] 
-------------------------------------------------------------------------

Responder a