1 14 15 package org.quickserver.util.xmlreader; 16 17 23 public class ObjectPoolConfig extends PoolConfig { 24 private ThreadObjectPoolConfig threadObjectPoolConfig; 25 private ClientHandlerObjectPoolConfig clientHandlerObjectPoolConfig; 26 private ByteBufferObjectPoolConfig byteBufferObjectPoolConfig; 27 private ClientDataObjectPoolConfig clientDataObjectPoolConfig; 28 private String poolManager = null; 29 30 34 public String getPoolManager() { 35 if(poolManager==null) 36 poolManager = "org.quickserver.net.server.impl.BasicPoolManager"; 37 return poolManager; 38 } 39 42 public void setPoolManager(String poolManager) { 43 this.poolManager = poolManager; 44 } 45 46 50 public ByteBufferObjectPoolConfig getByteBufferObjectPoolConfig() { 51 if(byteBufferObjectPoolConfig==null) 52 byteBufferObjectPoolConfig = new ByteBufferObjectPoolConfig(this); 53 return byteBufferObjectPoolConfig; 54 } 55 58 public void setByteBufferObjectPoolConfig(ByteBufferObjectPoolConfig byteBufferObjectPoolConfig) { 59 this.byteBufferObjectPoolConfig = byteBufferObjectPoolConfig; 60 } 61 62 66 public ClientHandlerObjectPoolConfig getClientHandlerObjectPoolConfig() { 67 if(clientHandlerObjectPoolConfig==null) 68 clientHandlerObjectPoolConfig = new ClientHandlerObjectPoolConfig(this); 69 return clientHandlerObjectPoolConfig; 70 } 71 74 public void setClientHandlerObjectPoolConfig(ClientHandlerObjectPoolConfig clientHandlerObjectPoolConfig) { 75 this.clientHandlerObjectPoolConfig = clientHandlerObjectPoolConfig; 76 } 77 78 82 public ThreadObjectPoolConfig getThreadObjectPoolConfig() { 83 if(threadObjectPoolConfig==null) 84 threadObjectPoolConfig = new ThreadObjectPoolConfig(this); 85 return threadObjectPoolConfig; 86 } 87 90 public void setThreadObjectPoolConfig(ThreadObjectPoolConfig threadObjectPoolConfig) { 91 this.threadObjectPoolConfig = threadObjectPoolConfig; 92 } 93 94 98 public ClientDataObjectPoolConfig getClientDataObjectPoolConfig() { 99 if(clientDataObjectPoolConfig==null) 100 clientDataObjectPoolConfig = new ClientDataObjectPoolConfig(this); 101 return clientDataObjectPoolConfig; 102 } 103 106 public void setClientDataObjectPoolConfig(ClientDataObjectPoolConfig clientDataObjectPoolConfig) { 107 this.clientDataObjectPoolConfig = clientDataObjectPoolConfig; 108 } 109 110 113 public String toXML(String pad) { 114 if(pad==null) pad=""; 115 StringBuffer sb = new StringBuffer (); 116 sb.append(pad+"<object-pool>\n"); 117 sb.append(pad+"\t<max-active>"+getMaxActive()+"</max-active>\n"); 118 sb.append(pad+"\t<max-idle>"+getMaxIdle()+"</max-idle>\n"); 119 sb.append(pad+"\t<init-size>"+getInitSize()+"</init-size>\n"); 120 sb.append(getThreadObjectPoolConfig().toXML(pad+"\t")); 121 sb.append(getClientHandlerObjectPoolConfig().toXML(pad+"\t")); 122 sb.append(getByteBufferObjectPoolConfig().toXML(pad+"\t")); 123 sb.append(getClientDataObjectPoolConfig().toXML(pad+"\t")); 124 sb.append(pad+"\t<pool-manager>"+getPoolManager()+"</pool-manager>\n"); 125 sb.append(pad+"</object-pool>\n"); 126 return sb.toString(); 127 } 128 } 129 | Popular Tags |