On Wed, Jul 23, 2008 at 10:00 PM, Wenrui Guo <[EMAIL PROTECTED]> wrote:
> I already locate the position where exception occurs. It seems like when > MINA receive a network packet which is longer than one message size, it > maybe move to not the start of a new message, instead, I notice it is > placed at the last byte of last message. Which parts of MINA to hande it? ( I mean, the class or the function) > > I don't know why this happened? Did I violate basic rules defined by > MINA? > > BR > anderson > > -----Original Message----- > From: Wenrui Guo [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 23, 2008 9:39 PM > To: [email protected] > Subject: RE: BufferedData continue to grow up - > > The Util class looks like this: > > public class Util { > > private Util() { > } > > public static boolean prefixedDataAvailable(IoBuffer in, int > prefixLength, > int maxLength) { > if (in.remaining() < prefixLength) > return false; > > int dataLength; > > switch (prefixLength) { > case 1: > dataLength = in.getUnsigned(in.position()); > break; > case 2: > dataLength = in.getUnsignedShort(in.position()); > break; > case 4: > dataLength = in.getInt(in.position()); > break; > default: > throw new > IllegalArgumentException("prefixLength: " + prefixLength); > } > > if (dataLength < 0 || dataLength > maxLength) { > throw new BufferDataException("dataLength: " + > dataLength); > } > return in.remaining() >= dataLength; > } > > BR > -----Original Message----- > From: Wenrui Guo [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 23, 2008 9:17 PM > To: [email protected] > Subject: RE: BufferedData continue to grow up - > > The following two encoder classes are taking the role to transform > messages. > > public class PDUWrapEncoder<T> implements MessageEncoder<T> { > > > public void encode(IoSession session, T message, > ProtocolEncoderOutput out) > throws Exception { > PDU pdu = (PDU) message; > out.write(IoBuffer.wrap(pdu.getData().getBuffer())); > } > > } > > public class ForwardMsgEncoder<T> implements MessageEncoder<T> { > > public void encode(IoSession session, T message, > ProtocolEncoderOutput out) > throws Exception { > } > } > > I already debugged the application under light workload, it seems ok. > But as long as I apply more than one thousand messages to the > application, it always throws the exception of dataLength. > > I think maybe some mistaken inside my source code. Is there anybody can > help to figure it out? > > BR > anderson >
