1 4 package com.tc.net.core; 5 6 import com.tc.exception.TCRuntimeException; 7 import com.tc.util.runtime.IOFlavor; 8 9 import java.lang.reflect.Constructor ; 10 11 16 public class TCConnectionManagerFactory { 17 18 private static TCConnectionManagerFactoryIF factory; 19 20 static { 21 Class clazz; 22 try { 23 if (IOFlavor.isNioAvailable()) { 24 clazz = Class.forName("com.tc.net.core.TCConnectionManagerJDK14Factory"); 25 } else { 26 clazz = Class.forName("com.tc.net.core.TCConnectionManagerJDK13Factory"); 27 } 28 29 Constructor cstr = clazz.getDeclaredConstructor(new Class [] {}); 30 factory = (TCConnectionManagerFactoryIF) cstr.newInstance(new Object [] {}); 31 } catch (Throwable t) { 32 throw new TCRuntimeException(t); 33 } 34 } 35 36 public TCConnectionManager getInstance() { 37 return factory.getInstance(null); 38 } 39 40 public TCConnectionManager getInstance(TCComm comm) { 41 return factory.getInstance(comm); 42 } 43 } | Popular Tags |