1 22 package org.jboss.proxy.ejb; 23 24 import java.io.Externalizable ; 25 import java.io.ObjectOutput ; 26 import java.io.ObjectInput ; 27 import java.io.IOException ; 28 import java.util.ArrayList ; 29 30 39 public class ReadAheadResult 40 implements Externalizable 41 { 42 43 private static final long serialVersionUID = -4041516583763000658L; 44 45 47 50 private ArrayList aheadList = new ArrayList (); 51 52 55 private Object [] aheadArray; 56 57 60 private Object mainResult; 61 62 64 66 public ReadAheadResult() 67 { 68 } 69 70 72 74 public void setMainResult(Object mainResult) 75 { 76 this.mainResult = mainResult; 77 } 78 79 public void addAheadResult(Object aheadResult) 80 { 81 aheadList.add(aheadResult); 82 } 83 84 public Object getMainResult() 85 { 86 return mainResult; 87 } 88 89 public Object [] getAheadResult() 90 { 91 if (aheadArray == null) 92 { 93 aheadArray = aheadList.toArray(new Object [aheadList.size()]); 94 aheadList = null; 95 } 96 return aheadArray; 97 } 98 99 101 103 104 106 public void writeExternal(ObjectOutput out) 107 throws IOException 108 { 109 out.writeObject(mainResult); 110 out.writeObject(getAheadResult()); 111 } 112 113 public void readExternal(ObjectInput in) 114 throws IOException , ClassNotFoundException 115 { 116 mainResult = in.readObject(); 117 aheadArray = (Object []) in.readObject(); 118 } 119 120 } 122 123 | Popular Tags |