1 21 package com.db4o.cs.messages; 22 23 import com.db4o.*; 24 import com.db4o.cs.*; 25 26 public final class MReadMultipleObjects extends MsgD { 27 28 public final boolean processAtServer(YapServerThread serverThread) { 29 int size = readInt(); 30 MsgD[] ret = new MsgD[size]; 31 int length = (1 + size) * YapConst.INT_LENGTH; 32 synchronized (streamLock()) { 33 for (int i = 0; i < size; i++) { 34 int id = this._payLoad.readInt(); 35 try { 36 YapWriter bytes = stream().readWriterByID(transaction(),id); 37 if(bytes != null){ 38 ret[i] = Msg.OBJECT_TO_CLIENT.getWriter(bytes); 39 length += ret[i]._payLoad.getLength(); 40 } 41 } catch (Exception e) { 42 if(Debug.atHome){ 43 e.printStackTrace(); 44 } 45 } 46 } 47 } 48 49 MsgD multibytes = Msg.READ_MULTIPLE_OBJECTS.getWriterForLength(transaction(), length); 50 multibytes.writeInt(size); 51 for (int i = 0; i < size; i++) { 52 if(ret[i] == null){ 53 multibytes.writeInt(0); 54 }else{ 55 multibytes.writeInt(ret[i]._payLoad.getLength()); 56 multibytes._payLoad.append(ret[i]._payLoad._buffer); 57 } 58 } 59 serverThread.write(multibytes); 60 return true; 61 } 62 } | Popular Tags |