当前位置: 首页>>代码示例>>Java>>正文


Java PerfMarker类代码示例

本文整理汇总了Java中org.globus.ftp.PerfMarker的典型用法代码示例。如果您正苦于以下问题:Java PerfMarker类的具体用法?Java PerfMarker怎么用?Java PerfMarker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PerfMarker类属于org.globus.ftp包,在下文中一共展示了PerfMarker类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: markerArrived

import org.globus.ftp.PerfMarker; //导入依赖的package包/类
public synchronized void markerArrived(Marker m) {
    if (m instanceof PerfMarker) {
        PerfMarker pm = (PerfMarker) m;
        int stripe = 0;
        try {
            if (pm.hasStripeIndex()) {
                stripe = (int) pm.getStripeIndex();
            }
            while (lastBytesTransfered.size() <= stripe) {
                lastBytesTransfered.add(0L);
            }
            if (pm.hasStripeBytesTransferred()) {
                long crt = pm.getStripeBytesTransferred();
                crtBytes += crt - lastBytesTransfered.get(stripe);
                lastBytesTransfered.set(stripe, crt);
            }
            long now = System.currentTimeMillis();
            if (now - lastTime > 1000) {
                String msg = "[GridFTP bandwidth] running average: " + units((crtBytes - lastBytes) / (now - lastTime) * 1000) + 
                        "B/s, average: " + units(crtBytes / (now - firstTime + 1) * 1000) + 
                        "B/s, total: " + units(crtBytes) + "B, per window: " + units(crtBytes - lastBytes) +
                        "B, window: " + (now - lastTime) / 1000 + 
                        "s, time: " + (now - firstTime) / 1000 + "s";
                logger.debug(msg);
                lastTime = now;
                lastBytes = crtBytes;
            }
        }
        catch (PerfMarkerException e) {
            logger.info("Cannot get performance marker information", e);
        }
    }
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:34,代码来源:FileResourceImpl.java

示例2: assertConstructorError

import org.globus.ftp.PerfMarker; //导入依赖的package包/类
/**
      Assume that arg represent an invalid message;
      ensure that constructor throws IllegalArgumentException.
    **/
   private void assertConstructorError(String arg) {
logger.info("checking bad construction:\n" + arg);
boolean threwOk = false;
try {
    new PerfMarker(arg);
} catch (IllegalArgumentException e) {
    threwOk = true;
} 

if (! threwOk ) {
    fail("constructor did not throw an exception when it should have");
}
logger.debug("okay, throws exception as expected.");
   }
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:19,代码来源:PerfMarkerTest.java

示例3: markerArrived

import org.globus.ftp.PerfMarker; //导入依赖的package包/类
public void markerArrived(Marker m) {
    if (m instanceof GridFTPRestartMarker) {
	restartMarkerArrived((GridFTPRestartMarker) m);
    } else if (m instanceof PerfMarker) {
	perfMarkerArrived((PerfMarker) m);
    } else {
	enclosing.fail("Received unsupported marker type");
    }
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:10,代码来源:MarkerTest.java

示例4: markerArrived

import org.globus.ftp.PerfMarker; //导入依赖的package包/类
public void markerArrived(Marker marker)
{
    try
    {
        if (marker instanceof PerfMarker)
        {
            PerfMarker perfMarker = (PerfMarker) marker;
            // Global.errorPrintln(this,"PerfMarker:"+perfMarker);
            // Global.errorPrintln(this,"PerfMarker.timestamp       :"+perfMarker.getTimeStamp());
            // Global.errorPrintln(this,"PerfMarker.stripIndex      :"+perfMarker.getStripeIndex());
            // Global.errorPrintln(this,"PerfMarker.totalStipeCount :"+perfMarker.getTotalStripeCount());
        }
        else if (marker instanceof GridFTPRestartMarker)
        {
            Vector vec = ((GridFTPRestartMarker) marker).toVector();
            // Global.errorPrintln(this,"GridFTPRestartMarker:"+((GridFTPRestartMarker)marker).toVector()
            // );

            if (vec != null)
            {
                // for (Object obj:vec)
                // {
                // Global.errorPrintln(this,"GridFTPRestartMarker: obj"+obj);
                // }
            }
        }
        else
        {
            // Global.errorPrintln(this,"Marker:"+marker.getClass());
        }

    }
    catch (Exception e)
    {
        ClassLogger.getLogger(TransferMarkerlistener.class).logException(ClassLogger.ERROR, e, "markerArrived() Exception\n");
    }

}
 
开发者ID:NLeSC,项目名称:vbrowser,代码行数:39,代码来源:TransferMarkerlistener.java


注:本文中的org.globus.ftp.PerfMarker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。