use of cbit.rmi.event.PerformanceData in project vcell by virtualcell.
the class ClientDocumentManager method initAllDatabaseInfos.
/**
* Insert the method's description here.
* Creation date: (9/25/2003 7:45:19 AM)
* @return cbit.vcell.modeldb.VCInfoContainer
*/
public synchronized void initAllDatabaseInfos() throws DataAccessException {
clear();
VCInfoContainer vcInfoContainer = null;
try {
System.out.println("ClientDocumentManager.initAllDatabaseInfos()");
long time1 = System.currentTimeMillis();
//
// gets BioModelMetaDatas, MathModelMetaDatas, all VersionInfos, and ResultSetInfos
//
vcInfoContainer = sessionManager.getUserMetaDbServer().getVCInfoContainer();
PerformanceMonitorEvent pme = new PerformanceMonitorEvent(this, getUser(), new PerformanceData("ClientDocumentManager.initAllDatabaseInfos()", MessageEvent.LOGON_STAT, new PerformanceDataEntry[] { new PerformanceDataEntry("remote call duration", Double.toString(((double) System.currentTimeMillis() - time1) / 1000.0)) }));
} catch (RemoteProxyException e) {
handleRemoteProxyException(e);
throw new DataAccessException("RemoteProxyException: " + e.getMessage());
}
//
// BioModelInfos
//
{
bioModelInfoHash.clear();
BioModelInfo[] bioModelInfos = vcInfoContainer.getBioModelInfos();
if (bioModelInfos != null) {
for (int i = 0; i < bioModelInfos.length; i++) {
bioModelInfoHash.put(bioModelInfos[i].getVersion().getVersionKey(), bioModelInfos[i]);
}
}
}
//
// Geometries
//
{
geoInfoHash.clear();
GeometryInfo[] geometryInfos = vcInfoContainer.getGeometryInfos();
if (geometryInfos != null) {
for (int i = 0; i < geometryInfos.length; i++) {
geoInfoHash.put(geometryInfos[i].getVersion().getVersionKey(), geometryInfos[i]);
}
}
}
//
// MathModelInfos
//
{
mathModelInfoHash.clear();
MathModelInfo[] mathModelInfos = vcInfoContainer.getMathModelInfos();
if (mathModelInfos != null) {
for (int i = 0; i < mathModelInfos.length; i++) {
mathModelInfoHash.put(mathModelInfos[i].getVersion().getVersionKey(), mathModelInfos[i]);
}
}
}
//
// VCImageInfos
//
{
imgInfoHash.clear();
VCImageInfo[] vcImageInfos = vcInfoContainer.getVCImageInfos();
if (vcImageInfos != null) {
for (int i = 0; i < vcImageInfos.length; i++) {
imgInfoHash.put(vcImageInfos[i].getVersion().getVersionKey(), vcImageInfos[i]);
}
}
}
fireDatabaseRefresh(new DatabaseEvent(this, DatabaseEvent.REFRESH, null, null));
}
use of cbit.rmi.event.PerformanceData in project vcell by virtualcell.
the class AsynchMessageManager method poll.
private void poll() {
if (!bPoll.get()) {
if (lg.isDebugEnabled()) {
lg.debug("polling stopped");
}
return;
}
if (lg.isDebugEnabled()) {
lg.debug("polling");
}
boolean report = counter % 50 == 0;
long begin = 0;
long end = 0;
//
try {
MessageEvent[] queuedEvents = null;
if (report) {
// time the call
begin = System.currentTimeMillis();
}
synchronized (this) {
if (!clientServerManager.isStatusConnected()) {
clientServerManager.attemptReconnect();
return;
}
pollTime = BASE_POLL_SECONDS;
queuedEvents = clientServerManager.getMessageEvents();
}
if (report) {
end = System.currentTimeMillis();
}
// this is skipped if the connection has failed:w
failureCount = 0;
// deal with events, if any
if (queuedEvents != null) {
for (MessageEvent messageEvent : queuedEvents) {
onMessageEvent(messageEvent);
}
}
// report polling call performance
if (report) {
double duration = ((double) (end - begin)) / 1000;
PerformanceMonitorEvent performanceMonitorEvent = new PerformanceMonitorEvent(this, null, new PerformanceData("AsynchMessageManager.poll()", MessageEvent.POLLING_STAT, new PerformanceDataEntry[] { new PerformanceDataEntry("remote call duration", Double.toString(duration)) }));
}
} catch (Exception exc) {
System.out.println(">> polling failure << " + exc.getMessage());
pollTime = ATTEMPT_POLL_SECONDS;
failureCount++;
if (failureCount % 3 == 0) {
bPoll.set(false);
clientServerManager.setDisconnected();
}
} finally {
if (lg.isDebugEnabled()) {
lg.debug(ExecutionTrace.justClassName(this) + " poll time " + pollTime + " seconds");
}
if (bPoll.get()) {
schedule(pollTime);
}
}
}
Aggregations