Search in sources :

Example 1 with PerformanceData

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));
}
Also used : VCInfoContainer(org.vcell.util.document.VCInfoContainer) PerformanceData(cbit.rmi.event.PerformanceData) PerformanceMonitorEvent(cbit.rmi.event.PerformanceMonitorEvent) PerformanceDataEntry(cbit.rmi.event.PerformanceDataEntry) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 2 with PerformanceData

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);
        }
    }
}
Also used : VCellMessageEvent(cbit.rmi.event.VCellMessageEvent) MessageEvent(cbit.rmi.event.MessageEvent) PerformanceData(cbit.rmi.event.PerformanceData) PerformanceMonitorEvent(cbit.rmi.event.PerformanceMonitorEvent) PerformanceDataEntry(cbit.rmi.event.PerformanceDataEntry) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

PerformanceData (cbit.rmi.event.PerformanceData)2 PerformanceDataEntry (cbit.rmi.event.PerformanceDataEntry)2 PerformanceMonitorEvent (cbit.rmi.event.PerformanceMonitorEvent)2 DataAccessException (org.vcell.util.DataAccessException)2 MessageEvent (cbit.rmi.event.MessageEvent)1 VCellMessageEvent (cbit.rmi.event.VCellMessageEvent)1 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)1 VCInfoContainer (org.vcell.util.document.VCInfoContainer)1