try {
// Should be a string passed
if (!args[0] instanceof String) {
// no good, return null
return null;
} // endif
// passed string
String Begin = (String) args[0];
// do the processing here
...
// form return value
String S = "#Demo1: " + "Other data";
/*
* The basic return string is finished. Now, to demonstrate the
* recurrsive ability of Tymeac. The method acts as a Client and
* calls the Tymeac Server for Function_2 with a synchronous
* request. The return string from this call is appended to the
* basic return string and all passes back to the original client.
*
* The second arg passed to this invoked method is the Tymeac Server
* interface. The object is cast to: TymeacInterface and and used in the
* method call for a syncRequest().
*
*/
// new string for Tymeac return
String x = "223344556677889911";
Object pass = (Object) x;
Object back[] = null;
// form a parameter for Tymeac
TymeacParm TP = new TymeacParm(pass,
// data
"Function_2", // function name
10,
// wait time
1);
// priority
// second arg is TymeacInterface
// do a sync request
back = ((TymeacInterface)args[1]).syncRequest(TP);
// Should be an array
if (back == null) {
String Z = S + " Recursion attempt did not complete
properly";
return (Object) Z;
} // endif
// number of objects in array
int nbr = back.length;
// concatenate all the strings
for (int i = 0; i < nbr; i++) {
// When a good string
if (back[i] != null) {
// concat
S = S.concat((String) back[i]);
} // endif
} // end-for
// return all values
return (Object) S;