@Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeInt(originCode); out.writeInt(ioType.ordinal()); out.writeObject(item); out.writeUTF(srcPath == null ? "" : srcPath); out.writeUTF(dstPath == null ? "" : dstPath); out.writeObject(credential); out.writeUTF(nodeAddr == null ? "" : nodeAddr); out.writeInt(status == null ? Status.PENDING.ordinal() : status.ordinal()); out.writeLong(reqTimeStart); out.writeLong(reqTimeDone); out.writeLong(respTimeStart); out.writeLong(respTimeDone); }
@Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { originCode = in.readInt(); ioType = IoType.values()[in.readInt()]; item = (I) in.readObject(); srcPath = in.readUTF(); dstPath = in.readUTF(); credential = (Credential) in.readObject(); nodeAddr = in.readUTF(); status = Status.values()[in.readInt()]; reqTimeStart = in.readLong(); reqTimeDone = in.readLong(); respTimeStart = in.readLong(); respTimeDone = in.readLong(); }
if(Status.SUCC.equals(status)) { if(ioTaskResult instanceof PartialIoTask) { ioTypeStats.markPartSucc(countBytesDone, reqDuration, respLatency); counterResults.increment(); } else if(!Status.INTERRUPTED.equals(status)) { Loggers.ERR.debug("{}: {}", ioTaskResult.toString(), status.toString()); ioTypeStats.markFail(); counterResults.increment();
final IoTask.Status status = ioTaskResult.getStatus(); if(Status.SUCC.equals(status)) { final long reqDuration = ioTaskResult.getDuration(); final long respLatency = ioTaskResult.getLatency(); counterResults.increment(); } else if(!Status.INTERRUPTED.equals(status)) { Loggers.ERR.debug("{}: {}", ioTaskResult.toString(), status.toString()); ioTypeStats.markFail(); counterResults.increment();
static <I extends DataItem, O extends DataIoTask<I>> boolean invokeOverwrite( final I fileItem, final O ioTask, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); if(countBytesDone == 0) { dstChannel.position(countBytesDone); } final long fileSize = fileItem.size(); if(countBytesDone < fileSize && IoTask.Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += fileItem.writeToFileChannel(dstChannel, fileSize - countBytesDone); ioTask.setCountBytesDone(countBytesDone); } return countBytesDone >= fileSize; } }
private void invokeCopy( final I fileItem, final O ioTask, final FileChannel srcChannel, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize && Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += srcChannel.transferTo( countBytesDone, contentSize - countBytesDone, dstChannel ); ioTask.setCountBytesDone(countBytesDone); } if(countBytesDone == contentSize) { finishIoTask(ioTask); } }
static <I extends DataItem, O extends DataIoTask<I>> boolean invokeCopy( final I fileItem, final O ioTask, final FileChannel srcChannel, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize && IoTask.Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += srcChannel.transferTo( countBytesDone, contentSize - countBytesDone, dstChannel ); ioTask.setCountBytesDone(countBytesDone); } return countBytesDone >= contentSize; }
private void invokeCreate( final I fileItem, final O ioTask, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize && Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += fileItem.writeToFileChannel(dstChannel, contentSize - countBytesDone); ioTask.setCountBytesDone(countBytesDone); } if(countBytesDone == contentSize) { finishIoTask(ioTask); } }
static <I extends DataItem, O extends DataIoTask<I>> boolean invokeCreate( final I fileItem, final O ioTask, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize && IoTask.Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += fileItem.writeToFileChannel(dstChannel, contentSize - countBytesDone); ioTask.setCountBytesDone(countBytesDone); } return countBytesDone >= contentSize; }