switch (msg.command()) { case HANDSHAKE: { out.write(hdr); if (msg.command() == AFFINITY) { out.writeLong(req.start()); out.writeLong(req.length()); else if (msg.command() == OPEN_CREATE) { out.writeInt(req.replication()); out.writeLong(req.blockSize()); else if (msg.command() == SET_TIMES) { out.writeLong(req.accessTime()); out.writeLong(req.modificationTime()); else if (msg.command() == OPEN_READ && req.flag()) out.writeInt(req.sequentialReadsBeforePrefetch()); case READ_BLOCK: case WRITE_BLOCK: { assert msg.command() != WRITE_BLOCK : "WRITE_BLOCK should be marshalled manually."; if (msg.command() == READ_BLOCK) U.intToBytes(req.length(), hdr, 20); if (msg.command() == READ_BLOCK) out.writeLong(req.position());
switch (msg.command()) { case HANDSHAKE: { out.write(hdr); if (msg.command() == AFFINITY) { out.writeLong(req.start()); out.writeLong(req.length()); else if (msg.command() == OPEN_CREATE) { out.writeInt(req.replication()); out.writeLong(req.blockSize()); else if (msg.command() == SET_TIMES) { out.writeLong(req.accessTime()); out.writeLong(req.modificationTime()); else if (msg.command() == OPEN_READ && req.flag()) out.writeInt(req.sequentialReadsBeforePrefetch()); case READ_BLOCK: case WRITE_BLOCK: { assert msg.command() != WRITE_BLOCK : "WRITE_BLOCK should be marshalled manually."; if (msg.command() == READ_BLOCK) U.intToBytes(req.length(), hdr, 20); if (msg.command() == READ_BLOCK) out.writeLong(req.position());
return null; final GridGgfsIpcCommand cmd = msg.command();
return null; final GridGgfsIpcCommand cmd = msg.command();
@Override public void applyx(GridFuture<GridGgfsMessage> fut) { GridGgfsMessage res; try { res = fut.get(); } catch (GridException e) { res = new GridGgfsControlResponse(); ((GridGgfsControlResponse)res).error(e); } try { synchronized (out) { byte[] hdr = GridGgfsMarshaller.createHeader(reqId, res.command()); marsh.marshall(res, hdr, out); out.flush(); } } catch (IOException | GridException e) { shutdown0(e); } } });
@Override public void applyx(GridFuture<GridGgfsMessage> fut) { GridGgfsMessage res; try { res = fut.get(); } catch (GridException e) { res = new GridGgfsControlResponse(); ((GridGgfsControlResponse)res).error(e); } try { synchronized (out) { byte[] hdr = GridGgfsMarshaller.createHeader(reqId, res.command()); marsh.marshall(res, hdr, out); out.flush(); } } catch (IOException | GridException e) { shutdown0(e); } } });
synchronized (out) { GridGgfsMarshaller.fillHeader(hdr, reqId, res.command());
synchronized (out) { GridGgfsMarshaller.fillHeader(hdr, reqId, res.command());