src/org/objectweb/cjdbc/common/monitor/client/AbstractClientDataCollector.java

説明を見る。
00001 00024 package org.objectweb.cjdbc.common.monitor.client; 00025 00026 import java.util.ArrayList; 00027 00028 import org.objectweb.cjdbc.common.exceptions.DataCollectorException; 00029 import org.objectweb.cjdbc.common.exceptions.ExceptionTypes; 00030 import org.objectweb.cjdbc.common.monitor.AbstractDataCollector; 00031 import org.objectweb.cjdbc.controller.core.Controller; 00032 import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase; 00033 import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread; 00034 00040 public abstract class AbstractClientDataCollector extends AbstractDataCollector 00041 { 00042 private String virtualDatabaseName; 00043 private String clientId; 00044 private int clientIndex; 00045 00051 public AbstractClientDataCollector(String virtualDatabaseName, String clientId) 00052 throws DataCollectorException 00053 { 00054 super(); 00055 this.virtualDatabaseName = virtualDatabaseName; 00056 this.clientId = clientId; 00057 setClientIndex(); 00058 } 00059 00060 private Object setClientIndex() throws DataCollectorException 00061 { 00062 VirtualDatabase vdb = ((Controller)controller).getVirtualDatabase( 00063 virtualDatabaseName); 00064 ArrayList activeThreads = vdb.getActiveThreads(); 00065 int size = activeThreads.size(); 00066 VirtualDatabaseWorkerThread client = null; 00067 int index = 0; 00068 for (index = 0; index < size; index++) 00069 { 00070 client = ((VirtualDatabaseWorkerThread) activeThreads.get(index)); 00071 if (client.getUser().equals(clientId)) 00072 break; 00073 else 00074 client = null; 00075 } 00076 00077 if (client == null) 00078 throw new DataCollectorException(ExceptionTypes.CLIENT_NOT_FOUND); 00079 else 00080 { 00081 this.clientIndex = index; 00082 return client; 00083 } 00084 } 00085 00086 private Object checkClientIndex() throws DataCollectorException 00087 { 00088 VirtualDatabase vdb = ((Controller)controller).getVirtualDatabase( 00089 virtualDatabaseName); 00090 ArrayList activeThreads = vdb.getActiveThreads(); 00091 VirtualDatabaseWorkerThread client = (VirtualDatabaseWorkerThread) activeThreads 00092 .get(clientIndex); 00093 if (client.getUser().equals(clientId)) 00094 return client; 00095 else 00096 { 00097 return setClientIndex(); 00098 } 00099 } 00100 00104 public long collectValue() throws DataCollectorException 00105 { 00106 VirtualDatabaseWorkerThread client = (VirtualDatabaseWorkerThread) checkClientIndex(); 00107 return this.getValue(client); 00108 } 00109 00116 public abstract long getValue(Object client); 00117 00121 public String getTargetName() 00122 { 00123 return clientId; 00124 } 00125 }

CJDBCversion1.0.4に対してTue Oct 12 15:15:57 2004に生成されました。 doxygen 1.3.8