1 20 package fr.dyade.aaa.agent; 21 22 import org.objectweb.util.monolog.api.BasicLevel; 23 24 28 class DriverConnect extends Driver { 29 protected ProxyAgent proxy = null; 30 protected boolean blockingCnx; 31 protected boolean multipleCnx; 32 33 DriverConnect(ProxyAgent proxy, boolean blockingCnx, boolean multipleCnx) { 34 this.proxy = proxy; 35 this.blockingCnx = blockingCnx; 36 this.multipleCnx = multipleCnx; 37 this.name = proxy.getName() + ".DriverConnect"; 38 logmon = proxy.logmon; 40 } 41 42 public void start() { 43 if (! blockingCnx) 44 run(); 45 else 46 super.start(); 47 } 48 49 public void run() { 50 try { 51 if (logmon.isLoggable(BasicLevel.DEBUG)) 52 logmon.log(BasicLevel.DEBUG, getName() + ", started"); 53 54 do { 55 proxy.createDrivers(); 56 } while (isRunning && multipleCnx); 57 } 58 catch (java.net.SocketException exc) { 59 if (! proxy.finalizing) { 60 logmon.log(BasicLevel.WARN, 61 "connection closed in createDrivers()", 62 exc); 63 } 64 } 65 catch (java.io.EOFException exc) { 66 if (! proxy.finalizing) { 67 logmon.log(BasicLevel.WARN, 68 "connection closed in createDrivers()", 69 exc); 70 } 71 } 72 catch (Exception exc) { 73 if (! proxy.finalizing) 74 logmon.log(BasicLevel.ERROR, "error in createDrivers()", exc); 75 } 76 } 77 78 public void close() {} 79 } 80 | Popular Tags |