[erlang-questions] Cannot Connect to peer node - Jinterface (Siddharth Pareek)

Pradeep Gunawardana <>
Tue Mar 20 11:44:14 CET 2007


Hi Siddharth

Check whether you are trying to connect multiple times using same otppeer .
if yes , change the otppeer for unique each time . 
you can not connect same otppeer multiple times without closing previous connections.

you can create deferent class for connect to remote node and handle the all exceptions 
inside it, here is the little example  .

public class Conn{

    static long baseTime = 1;
    OtpConnection connection;
    protected String hidClient;

    
    public Conn()throws Exception { 
	 hidClient= "_" + baseTime;
         baseTime = baseTime + 1; 
    }

    public OtpConnection databaseConn(String peer, String cookie) {
        try {
            OtpSelf self = new OtpSelf(hidClient, cookie.trim());
            OtpPeer other = new OtpPeer(peer.trim());
            return connection = self.connect(other);

        } catch (Exception exp) {
            myLogger.error("connection error " + exp.toString());
            return null;
        }
    }

  ...
  ...

  Regards 
   Pradeep







More information about the erlang-questions mailing list