1 55 56 package org.apache.bsf.debug; 57 58 import java.io.IOException ; 59 import org.apache.bsf.debug.clientImpl.ClientConnection; 60 import org.apache.bsf.debug.meta.DebugManagerStub; 61 import org.apache.bsf.debug.util.DebugConstants; 62 63 public class BSFConnect { 64 private static ClientConnection con = null; 65 66 public static synchronized BSFDebugManager connect(String host, 67 int portno) 68 throws IOException { 69 if (host == null) host = "localhost"; 70 if (portno == -1) { 71 Integer port = Integer.getInteger("org.apache.bsf.serverPort", 72 -1); 73 portno = (port.intValue() > 0) ? port.intValue() : 74 DebugConstants.BSF_DEBUG_SERVER_PORT; 75 } 76 77 con = new ClientConnection(host, portno); 78 return con.getDebugManager(); 79 } 80 81 public static synchronized void disconnect() { 82 if (con != null) { 83 con.breakConnection(); 84 con = null; 85 } 86 } 87 } 88 | Popular Tags |