Tymeac Server Parameters
Tymeac functions as a client/server pair. The Tymeac Client requests a Function and the
Tymeac Server services the request.

The parameters for the Tymeac Server, filled in by the
Client application follow the scenario:
Execute this Function, A,
- using this optional input Object, B,
at this priority, C,
returning a Tymeac return code, D, and for:
| Synchronous Requests |
wait for completion no longer
than this interval, E,
optionally prime for a subsequent cancel with this
cancel word or callback to this object, F
returning an optional result, G |
Asynchronous Requests |
Return Data, H |
Where:
A: Function: (java.lang.String) The
name of the Function previously defined in the Function Maintenance Class (TyFuncMaint) or
User Class (TymeacUserFunctions.)
B: Input: (Object) Is an optional
Object the Tymeac Queue Thread passes to each Queue's Processing Application Class. One
Object to All Classes. Each Class must cast the Object to the expected Class
and either parse the Class looking for keywords or use positional processing.
The Demonstration System Classes, Demo1-3, use positional processing. The input
String is a set of eighteen digits. Demo1 uses the first group of six digits. Demo2
uses the second group of six digits. Demo3 uses the third group of six digits.
C: Priority: (integer) Is the Wait List into
which Tymeac places the request. An invalid (<1 or NaN) priority defaults to
1. A priority greater than that which is valid on a Queue defaults to the maximum
priority on that Queue.
Priority 1 goes into the first Wait List. Priority 2 goes into the second Wait List,
etc. The Tymeac Thread processes Wait Lists from the first to the last, always exhausting
all entries in the first before moving on to the next.
D: Return Code: (java.lang.String) cast to an Object
and placed in the first occurrence (index 0) of the return Object array. [See below, G:Result
for a picture of this]
This String is in the format: "Tymeac XX(yyyy)", where:
Tymeac is a constant.
XX is the type of request that was passed to the Tymeac Server. SR
for Synchronous Request, AR for Asynchronous Request and SD
for Shutdown Request. This type aids in parsing what may follow.
(yyyy) is the parentheses enclosed, Tymeac Return Code detailed in the
Usage document. Zero (four digits -- 0000) is normal. However, this is the result of
the Tymeac Server brokering/scheduling, not the result of application processing.
For Synchronous Requests, the output message of each Processing Application Class (G:Result
below) may contain the completion result for application processing.
E: Interval: (integer) For Synchronous
Requests, only.
This is the maximum time the Tymeac Server waits for all Queues to finish
processing the request after scheduling all Queues. The Tymeac Server gives
Queue Threads every opportunity to complete. If overall timing is important than do
so in the requesting Client, at the higher level. The higher level times the lower
level. Lower levels cannot know the purpose of timing.
Seconds: (integer) This number is multiplied by 1000 to get the
wait time in milliseconds. To use a time less than a full second, specify zero and fill in
a number of milliseconds, below.
Milliseconds: (integer) This number is added to the above seconds
to achieve the total wait time in milliseconds.
F: Cancel Word or Callback. These are optional
parameters.For Synchronous Requests, only.
These fields are for use in canceling a Synchronous Request with the cancelSyncReq()
method. Please read the documentation on canceling requests
for the details.
Cancel Word (long) This is a unique number supplied by the
Client to associate this synchronous request. If the Client later wishes to cancel this
synchronous request, it passes this number to the Server in a cancelSyncReq() method. The
default is zero.
Callback: (InterruptionReady) This is an alternate means for the
Client to cancel a synchronous request. The default is null. When used, it must be an
instance of the InterruptionReady interface.
G: Result: (Object[]) For Synchronous
Requests, the concatenated output Objects from each Queue's Processing Application Class,
if any. These are appended to the above, D: Return Code.
For example using a Function with two Queues: Object[] back:
back[0] (is a String cast to an Object) "Tymeac SR(0000)"
back[1] (may be any Object) Queue1 data
back[2] (may be any Object) Queue2 data ...
The Return Code (D) and this Result is for every Synchronous Request
including recursive requests.
The order of the result array Objects from the second to the end is the order that each
Queue finished processing. You may have a Function with three Queues named A, B, C.
The result array order may be B, A, C. It is the order of completion not the order within
the Function. Therefore, each returned Object should have its own identification contained
therein.
The length of the result array is one greater than the number of Queues in the Function
that had return data. (The first being the Tymeac Return code data.) Tymeac
does not pass back null Objects in the Object array.
For synchronous requests that time out or are cancelled, partial results are possible.
In such a case the length of the result array is still one greater than the number of
Queues in the Function that executed and that had return data.
For example, using the above Function with three Queues, A, B, C. When a time out or
cancel occurs with only one Queue complete and that Queue had return data, the array
appears as follows:
back[0] (is a String cast to an Object) "Tymeac SR(4120)" [time-out]
back[1] Object from Queue A [or B or C]
For Asynchronous Requests, when there is an Output Agent Queue,
Tymeac holds the individual result Object from each Queue's Processing Application Class.
When all Queues finish processing, Tymeac passes the results Objects concatenated in an
Object array to the Output Agent Queue. This looks like what is passed back to a
synchronous request, but without the Return Code (D).
An example is the Demonstration System, DemoAgent1, Processing Application
Class. This Output Agent Class receives the concatenated Objects of other Classes in
the Function.
H: Return Data: (java.lang.String) cast to
an Object and placed in the first occurrence (index 0) of the return Object[].)
Since there are no output Objects from each Queue's Processing Application Class for an
asynchronous request, the length of the array is one (1).
For Asynchronous Requests, the information necessary to track the request in the Tymeac
system, only. This information is necessary when using the Request Status GUI Class,
TyReqStatus, or instantiated Class, TyUserStatus. The information is only valid for a
single affinity of Tymeac and only for a single session (the time from Tymeac Start Up and
before Tymeac Shut Down.)
The format, enclosed in brackets, is: [MilliTime, Request Id].
This immediately follows the Tymeac Return Code (D:, above). For
example, Tymeac AR(0000)[9001234567,5]
MilliTime: This is the time Tymeac started in milliseconds from
1970. (System.currentTimeMillis())
The MilliTime, here, is the same as the MilliTime on the Tymeac successful Start up
message and final Shut down message.
- Request Id: This is a sequential number starting at one (1), for each
Asynchronous Request in the current session of the Tymeac Server. When using
the Activation Framework, the Tymeac Sever may inactivate and reactivate many
times. At each reactivation, the Activation Framework creates a new Java Virtual
Machine and instantiates a new Tymeac Server, therefore, this sequence number restarts at
one (1).

EXAMPLES
// A String for the Tymeac Demonstration Function desired:
String func = "Function_2";
// A String for the input data needed by the application classes:
String x = "112233445566778899";
Object data = (Object) x;
// A Priority for the request:
int priority = 1;
// A maximum time to wait for completion, in seconds:
int wait_time = 10;
// The Parameter:
com.tymeac.base.TymeacParm TP = new com.tymeac.base.TymeacParm(data, func, wait_time,
priority);
/* The Request, using the Tymeac Server Communication Class, TySvrComm, and returning a
String: */
// synchronous request:
Object[] R = new com.tymeac.demo.TySvrComm().syncRequest(TP);
// asynchronous request:
Object[] R = new com.tymeac.demo.TySvrComm().asyncRequest(TP);
The sample classes in the Source library are available for your use.
|