本文整理汇总了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);
}
}
}
示例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.");
}
示例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");
}
}
示例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");
}
}