private void retrieve(Attributes keys) throws IOException, InterruptedException { DimseRSPHandler rspHandler = new DimseRSPHandler(as.nextMessageID()) { int lastRemaining = -1; long lastChanged; @Override public void onDimseRSP(Association as, Attributes cmd, Attributes data) { super.onDimseRSP(as, cmd, data); if (idleRetrieveTimeout != -1 && Status.isPending(cmd.getInt(Tag.Status, -1))) { int remaining = cmd.getInt(Tag.NumberOfRemainingSuboperations, -1); if (remaining > 0) { if (lastRemaining != remaining) { lastRemaining = remaining; lastChanged = System.currentTimeMillis(); } else { long idleTime = System.currentTimeMillis() - lastChanged; if (idleTime > idleRetrieveTimeout) { LOG.warn( "Cancel C-MOVE request after " + idleTime + "ms of idle time! response:" + cmd); try { exitCode = 3; cancel(as); } catch (IOException e) { e.printStackTrace(); } } else { LOG.info( "C_MOVE Request is idle for " + idleTime + "ms! idleRetrieveTimeout=" + idleRetrieveTimeout); } } } } } }; as.cmove(model.cuid, priority, keys, null, destination, rspHandler); }
public void retrieve(Attributes keys, DimseRSPHandler handler) throws IOException, InterruptedException { as.cmove(model.cuid, priority, keys, null, destination, handler); }