private void createAmpResultStreamMethod(JavaClass jClass,Method method,int resultOffset){
  String methodName=method.getName();
  Class<?>[] parameterTypes=method.getParameterTypes();
  Annotation[][] parameterAnns=method.getParameterAnnotations();
  addMethod(method);
  CodeWriterAttribute code=createMethodHeader(jClass,method);
  code.setMaxLocals(1 + 2 * parameterTypes.length);
  code.setMaxStack(10 + 2 * parameterTypes.length);
  code.pushObjectVar(0);
  code.getField(jClass.getThisClass(),"_messageFactory",MessageFactoryAmp.class);
  int argLen=parameterTypes.length - 1;
  code.pushObjectVar(getLength(parameterTypes,resultOffset) + 1);
  long timeout=_defaultTimeout;
  code.pushConstant(timeout);
  code.pushObjectVar(0);
  code.getField(jClass.getThisClass(),"_serviceRef",ServiceRefAmp.class);
  code.pushObjectVar(0);
  code.getField(jClass.getThisClass(),fieldName(method),MethodAmp.class);
  partitionMethod(code,parameterTypes,parameterAnns);
  pushParameters(code,parameterTypes,parameterAnns,1,0,argLen + 1,resultOffset);
  code.invokeInterface(MessageFactoryAmp.class,"streamResult",void.class,ResultStream.class,long.class,ServiceRefAmp.class,MethodAmp.class,Object[].class);
  code.addReturn();
  code.close();
}

private void createAmpResultStreamMethod ( JavaClass jClass , Method method , int resultOffset ) { String methodName = method . getName ( ) ; Class < ? > [ ] parameterTypes = method . getParameterTypes ( ) ; Annotation [ ] [ ] parameterAnns = method . getParameterAnnotations ( ) ; addMethod ( method ) ; CodeWriterAttribute code = createMethodHeader ( jClass , method ) ; code . setMaxLocals ( 1 + 2 * parameterTypes . length ) ; code . setMaxStack ( 10 + 2 * parameterTypes . length ) ; code . pushObjectVar ( 0 ) ; code . getField ( jClass . getThisClass ( ) , "_messageFactory" , MessageFactoryAmp . class ) ; int argLen = parameterTypes . length - 1 ; code . pushObjectVar ( getLength ( parameterTypes , resultOffset ) + 1 ) ; long timeout = _defaultTimeout ; code . pushConstant ( timeout ) ; code . pushObjectVar ( 0 ) ; code . getField ( jClass . getThisClass ( ) , "_serviceRef" , ServiceRefAmp . class ) ; code . pushObjectVar ( 0 ) ; code . getField ( jClass . getThisClass ( ) , fieldName ( method ) , MethodAmp . class ) ; partitionMethod ( code , parameterTypes , parameterAnns ) ; pushParameters ( code , parameterTypes , parameterAnns , 1 , 0 , argLen + 1 , resultOffset ) ; code . invokeInterface ( MessageFactoryAmp . class , "streamResult" , void . class , ResultStream . class , long . class , ServiceRefAmp . class , MethodAmp . class , Object [ ] . class ) ; code . addReturn ( ) ; code . close ( ) ; }
void foo ( x a1 , y a2 , resultstream < t > result ) { stream ( __caucho_getcurrentcontext ( ) , cont , timeout , _methodref , new object [ ] { a1 , a2 } ) . send ( ) ; }
