long start = System.nanoTime();
try {
int numArgs = method.getParameterTypes().length;
Object[] args = new Object[numArgs];
TProtocolReader reader = new TProtocolReader(in);
// Map incoming arguments from the ID passed in on the wire to the position in the
// java argument list we expect to see a parameter with that ID.
reader.readStructBegin();
while (reader.nextField()) {
short fieldId = reader.getFieldId();
ThriftCodec<?> codec = parameterCodecs.get(fieldId);
if (codec == null) {
// unknown field
reader.skipFieldData();
}
else {
// Map the incoming arguments to an array of arguments ordered as the java
// code for the handler method expects to see them
args[thriftParameterIdToJavaArgumentListPositionMap.get(fieldId)] = reader.readField(codec);
}
}
reader.readStructEnd();
// Walk through our list of expected parameters and if no incoming parameters were
// mapped to a particular expected parameter, fill the expected parameter slow with
// the default for the parameter type.
int argumentPosition = 0;