* Make sure Request and Session are created with a funciton name placeholder
even if invokeInternal() is called with a function object. Some cleaning up, do not declare recycle() as public.
This commit is contained in:
parent
72487ca844
commit
dbcb600857
1 changed files with 20 additions and 18 deletions
|
@ -794,9 +794,7 @@ public final class RequestEvaluator implements Runnable {
|
||||||
*/
|
*/
|
||||||
public synchronized Object invokeXmlRpc(String functionName, Object[] args)
|
public synchronized Object invokeXmlRpc(String functionName, Object[] args)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
initObjects(functionName, XMLRPC, RequestTrans.XMLRPC);
|
initObjects(functionName, args, XMLRPC, RequestTrans.XMLRPC);
|
||||||
this.functionName = functionName;
|
|
||||||
this.args = args;
|
|
||||||
|
|
||||||
startTransactor();
|
startTransactor();
|
||||||
wait(app.requestTimeout);
|
wait(app.requestTimeout);
|
||||||
|
@ -828,9 +826,7 @@ public final class RequestEvaluator implements Runnable {
|
||||||
*/
|
*/
|
||||||
public synchronized Object invokeExternal(String functionName, Object[] args)
|
public synchronized Object invokeExternal(String functionName, Object[] args)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
initObjects(functionName, EXTERNAL, RequestTrans.EXTERNAL);
|
initObjects(functionName, args, EXTERNAL, RequestTrans.EXTERNAL);
|
||||||
this.functionName = functionName;
|
|
||||||
this.args = args;
|
|
||||||
|
|
||||||
startTransactor();
|
startTransactor();
|
||||||
wait();
|
wait();
|
||||||
|
@ -896,12 +892,11 @@ public final class RequestEvaluator implements Runnable {
|
||||||
public synchronized Object invokeInternal(Object object, Object function,
|
public synchronized Object invokeInternal(Object object, Object function,
|
||||||
Object[] args, long timeout)
|
Object[] args, long timeout)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
initObjects(functionName, INTERNAL, RequestTrans.INTERNAL);
|
String funcName = function instanceof String ?
|
||||||
|
(String) function : null;
|
||||||
|
initObjects(funcName, args, INTERNAL, RequestTrans.INTERNAL);
|
||||||
thisObject = object;
|
thisObject = object;
|
||||||
if (function instanceof String)
|
|
||||||
this.functionName = (String) function;
|
|
||||||
this.function = function;
|
this.function = function;
|
||||||
this.args = args;
|
|
||||||
|
|
||||||
startTransactor();
|
startTransactor();
|
||||||
if (timeout < 0)
|
if (timeout < 0)
|
||||||
|
@ -943,15 +938,22 @@ public final class RequestEvaluator implements Runnable {
|
||||||
* Init this evaluator's objects for an internal, external or XML-RPC type
|
* Init this evaluator's objects for an internal, external or XML-RPC type
|
||||||
* request.
|
* request.
|
||||||
*
|
*
|
||||||
* @param functionName
|
* @param funcName the function name, may be null
|
||||||
* @param reqtype
|
* @param args the argument array
|
||||||
* @param reqtypeName
|
* @param reqtype the request type
|
||||||
|
* @param reqtypeName the request type name
|
||||||
*/
|
*/
|
||||||
private synchronized void initObjects(String functionName, int reqtype, String reqtypeName) {
|
private synchronized void initObjects(String funcName, Object[] args,
|
||||||
this.functionName = functionName;
|
int reqtype, String reqtypeName) {
|
||||||
|
this.functionName = funcName;
|
||||||
|
this.args = args;
|
||||||
this.reqtype = reqtype;
|
this.reqtype = reqtype;
|
||||||
req = new RequestTrans(reqtypeName, functionName);
|
// if function name is null, use a placeholder for req, session etc,
|
||||||
session = new Session(functionName, app);
|
// but make sure functionName field remains null.
|
||||||
|
if (funcName == null)
|
||||||
|
funcName = "<function>";
|
||||||
|
req = new RequestTrans(reqtypeName, funcName);
|
||||||
|
session = new Session(funcName, app);
|
||||||
res = new ResponseTrans(app, req);
|
res = new ResponseTrans(app, req);
|
||||||
result = null;
|
result = null;
|
||||||
exception = null;
|
exception = null;
|
||||||
|
@ -1002,7 +1004,7 @@ public final class RequestEvaluator implements Runnable {
|
||||||
/**
|
/**
|
||||||
* Null out some fields, mostly for the sake of garbage collection.
|
* Null out some fields, mostly for the sake of garbage collection.
|
||||||
*/
|
*/
|
||||||
public synchronized void recycle() {
|
synchronized void recycle() {
|
||||||
res = null;
|
res = null;
|
||||||
req = null;
|
req = null;
|
||||||
session = null;
|
session = null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue