|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPIRL.Conductor.Maestro.Theater
PIRL.Conductor.Maestro.Remote_Theater
public class Remote_Theater
A Remote_Theater implements the remote Conductor management
side of a Theater
.
A Remote_Theater is used by network distributed clients that will be
using the Management
interface of Conductors via a
Stage_Manager proxy server.
Message_Delivered_Listener
Field Summary | |
---|---|
static int |
DEFAULT_MESSAGE_RETRIES
The default number of protocol transmission retries before a Remote_Management_Exception will be thrown. |
static int |
DEFAULT_RESPONSE_TIMEOUT
The default amount of time (seconds) to wait for a response to a protocol message. |
static String |
ID
Class identification name with source code version and date. |
protected int |
NACK_Messages
Problem case message accounting. |
protected Message_Delivered_Listener |
Non_Protocol_Message_Listener
Object to which non-protocol Messages will be delivered. |
static String |
REMOTE_THEATER_NAME
The name to be used in describing objects of this class. |
protected int |
Undeliverable_Messages
Problem case message accounting. |
protected int |
Unknown_Messages
Problem case message accounting. |
Constructor Summary | |
---|---|
Remote_Theater()
|
|
Remote_Theater(String host,
int port,
Message identity,
String connection_address)
|
|
Remote_Theater(String host,
Message identity,
String connection_address)
|
Method Summary | |
---|---|
Management |
Add_Log_Writer(Writer writer)
Register a Writer to receive processing log stream output. |
Management |
Add_Processing_Listener(Processing_Listener listener)
Register a processing state change listener. |
boolean |
Close()
Close this Theater. |
Message |
Conductor_Identity()
Get the identity of the Conductor with which this Remote_Theater is associated. |
Configuration |
Configuration()
Get the Conductor Configuration. |
boolean |
Connected_to_Stage_Manager()
Test if the Conductor is connected to a Stage_Manager. |
Management |
Enable_Log_Writer(Writer writer,
boolean enable)
Enable or disable output to a registered log stream Writer . |
Message |
Identity()
Get the Conductor identity . |
Message |
Listener_Identity()
Get the identity description of this Conductor Management interface implementation. |
void |
Message_Delivered(Message_Delivered_Event event)
Take delivery of a Message. |
int |
Message_Retries()
Get the maximum number of protocol message retries before a Remote_Management_Exception will be thrown. |
Remote_Theater |
Message_Retries(int retries)
Set the number of protocol message retries before a Remote_Management_Exception will be thrown. |
int |
NACK_Messages()
Get the number of NACK (negative acknowledge) messages that have occurred. |
Message_Delivered_Listener |
Non_Protocol_Message_Listener()
Get the listener for non-protocol messages. |
Remote_Theater |
Non_Protocol_Message_Listener(Message_Delivered_Listener listener)
Set the listenter for non-protocol messages. |
void |
Open(String host,
int port,
Message identity,
String connection_address)
Open this Theater. |
void |
Open(String host,
Message identity,
String connection_address)
Open this Theater. |
int |
Poll_Interval()
Get the interval at which the Conductor will poll for unprocessed source records. |
Management |
Poll_Interval(int seconds)
Set the interval at which the Conductor will poll for unprocessed source records. |
Vector<Vector<String>> |
Procedures()
Get the procedures table. |
Exception |
Processing_Exception()
Get the most recent Exception from the Conductor. |
int |
Processing_State()
Get the current Conductor processing state. |
void |
Quit()
Immediately stop Conductor processing and exit. |
boolean |
Remove_Log_Writer(Writer writer)
Unregister a log Writer. |
boolean |
Remove_Processing_Listener(Processing_Listener listener)
Unregister a processing state change listener. |
Management |
Reset_Sequential_Failures()
Reset the count of sequential source processing failures that the Conductor has accumulated. |
String |
Resolver_Default_Value()
Get the Conductor default Reference_Resolver value. |
Management |
Resolver_Default_Value(String value)
Set the Conductor default Reference_Resolver value. |
int |
Response_Timeout()
Get the amount of time to wait for a response to a protocol message. |
Remote_Theater |
Response_Timeout(int seconds)
Set the amount of time to wait for a response to a protocol message. |
protected Message |
Send_and_Wait(Message message)
Send a Message and wait for a response. |
int |
Sequential_Failures()
Get the count of sequential source processing failures that the Conductor has accumulated. |
Vector<Vector<String>> |
Sources()
Get the current cache of source records. |
void |
Start()
Start Conductor source record processing. |
Processing_Changes |
State()
Get the current Conductor processing state variables. |
int |
Stop_on_Failure()
Get the number of Conductor sequential source processing failures at which to stop processing. |
Management |
Stop_on_Failure(int failure_count)
Set the number of Conductor sequential source processing failures at which to stop processing. |
void |
Stop()
Request that Conductor stop source record processing. |
String |
toString()
Get the description of this Theater. |
int |
Undeliverable_Messages()
Get the number of undeliverable messages that have occurred. |
int |
Unknown_Messages()
Get the number of unknown messages that have occurred. |
protected Message |
Wait_for_Response()
Wait for a response Message. |
Methods inherited from class PIRL.Conductor.Maestro.Theater |
---|
Action_Code, Default_Port, Default_Port, Default_Receive_Timeout, Default_Receive_Timeout, Employer, Full_Location, Host, Listen_for_Messages, Location, Location, Messenger, NACK, Name, Open, Open, Opened, Port, Processing_Changes, Processing_Changes, Receive_Message, Receive_Timeout, Receive_Timeout, Record, Send_Message, Stage_Manager_Identity, Table |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ID
public static final String REMOTE_THEATER_NAME
public static final int DEFAULT_RESPONSE_TIMEOUT
public static final int DEFAULT_MESSAGE_RETRIES
protected Message_Delivered_Listener Non_Protocol_Message_Listener
protected int Undeliverable_Messages
protected int NACK_Messages
protected int Unknown_Messages
Constructor Detail |
---|
public Remote_Theater(String host, int port, Message identity, String connection_address) throws IOException
IOException
public Remote_Theater(String host, Message identity, String connection_address) throws IOException
IOException
public Remote_Theater()
Method Detail |
---|
public int Response_Timeout()
public Remote_Theater Response_Timeout(int seconds)
seconds
- The maximum amount of time (seconds) to wait for a response
to a protocol message. If less than or equal to zero the
DEFAULT_RESPONSE_TIMEOUT
will be used.
public Message Conductor_Identity()
N.B.: The availability of a Conductor identity does not imply
that this Remote_Theater is opened
for
that Conductor.
Conductor
identity Message
. This will be an empty Message if no identity
has yet been obtained. It will be null if the identity has become
corrupted.public int Message_Retries()
public Remote_Theater Message_Retries(int retries)
retries
- The maximum number of protocol message retries.
If zero the DEFAULT_MESSAGE_RETRIES
will be used. If
negative retries will continue until successful (this could
result in an indefintate protocol hang).
public int Undeliverable_Messages()
An underliverable Message contains the Theater.UNDELIVERABLE_ACTION
value for the Theater.ACTION_PARAMETER_NAME
.
public int NACK_Messages()
A NACK Message contains the Theater.NACK_ACTION
value for the
Theater.ACTION_PARAMETER_NAME
.
public int Unknown_Messages()
An unknown message has no Theater.ACTION_PARAMETER_NAME
, this
parameter has no value, or the value is not known as a protocol
action. A listener
may be
set to receive non-protocol messages.
Non_Protocol_Message_Listener(Message_Delivered_Listener)
public Message_Delivered_Listener Non_Protocol_Message_Listener()
Non_Protocol_Message_Listener(Message_Delivered_Listener)
public Remote_Theater Non_Protocol_Message_Listener(Message_Delivered_Listener listener)
A non-protocol message does not participate in the implementation of
the remote Conductor Management interface. This includes Messages
with the Theater.DONE_ACTION
, Theater.UNDELIVERABLE_ACTION
, Theater.NACK_ACTION
or Theater.MESSENGERS_REPORT_ACTION
value for the
Theater.ACTION_PARAMETER_NAME
, or any message that does not have a
recognized protocol action.
listener
- A Message_Delivered_Listener to which non-protocol
messages will be delivered.
Non_Protocol_Message_Listener()
public String toString()
Theater
The first line of the description is the class Theater.ID
. The second
line of the description provides the Theater location, if it is
known, and whether or not the Theater is open. If the Theater has a
Messenger
its description is included on the
following lines.
toString
in class Theater
public void Open(String host, int port, Message identity, String connection_address) throws IOException
The current communication channel is closed
. A new
connection
with the
Stage_Manager is established using the identity provided.
Then a Theater.CONDUCTOR_CONNECT_ACTION
Message is sent to the
Stage_Manager with the connection ID. The response is checked for an
Theater.EXPLANATION_PARAMETER_NAME
indicating that the request could
not be satisfied (unknown Messenger ID). If the response is good then
the route-to list
of the Conductor
Identity Message is set to the value provided by its Theater.ROUTE_TO_PARAMETER_NAME
parameter.
host
- The name or IP address of the host system where a
Stage_Manager is running. If null, "localhost" will be used.port
- The port number to use to establish the
communication connection. If less than or equal to zero the
default port
will be used.identity
- The Message used to provide the Stage_Manager
with the required identity information.connection_address
- The Messenger address
used by the Stage_Manager to identify the Messenger used
to establish a connection with the Local_Theater object
bound to a Conductor.
IOException
- If a connection could not be established to
the Stage_Manager. This will be a Theater_Protocol_Exception
if there were any problems in the content of the Messages
used to establish the connection.
IllegalArgumentException
- If the identity or connection_address
is null.Theater.Open(String, int, Message)
public void Open(String host, Message identity, String connection_address) throws IOException
The default port
will be used.
host
- The name or IP address of the host system where a
Stage_Manager is running. If null, "localhost" will be used.identity
- The Message used to provide the Stage_Manager
with the required identity information.connection_address
- The Messenger address
used by the Stage_Manager to identify the Messenger used
to establish a connection with the Local_Theater object
bound to a Conductor.
IOException
- If a connection could not be established to
the Stage_Manager. This will be a Theater_Protocol_Exception
if there were any problems in the content of the Messages
used to establish the connection.
IllegalArgumentException
- If the identity or connection_address
is null.Open(String, int, Message, String)
public boolean Close()
If currently opened
a Theater.CONDUCTOR_DISCONNECT_ACTION
Message is sent
with the Theater.ADDRESS_PARAMETER_NAME
set from the same parameter of the
Conductor identity
. Then the
communication channel is closed
.
Close
in class Theater
public Message Listener_Identity()
Listener_Identity
in interface Message_Delivered_Listener
public void Message_Delivered(Message_Delivered_Event event)
The Action parameter value of the event's
Message is used to determine an action
code
that selects a handler method if the Action is known.
The delivered Message is handled before returning. Most Messages
will just be posted as a Response which will wake up any thread that
is waiting for a response
. Typically
this happens as a result of a send-and_wait message
.
Messages that are asynchronously conveying Conductor processing
events
or Conductor log reports
are
handled immediately.
Non-protocol messages are delivered to the non-protocol
listener
, if there is one.
Message_Delivered
in interface Message_Delivered_Listener
event
- The Message_Delivered_Event containing the Message
to be delivered and a reference to the delivering Messenger.protected Message Send_and_Wait(Message message)
The previous response is cleared, the Message is sent and then the
current thread is blocked waiting for a
response
. When the response arrives it is returned.
message
- The Message to be sent.
response timeout
expired.
Check if the Stage_Manager is opened
to
determine the exact cause of a null response.
Remote_Management_Exception
- If Message could not be sent
because it contains invalid PVL.protected Message Wait_for_Response()
If a non-null response is currently posted that will be immediately
returned without any waiting. N.B.: The previously posted
response must be cleared when it is no longer relevant or it will be
incorrectly returned as the new response; Send_and_Wait(Message)
, for example, clears the response before
sending a message that is expected to result in a new response.
After confirming that there is no response available a thread is
started that will sleep until the response
timeout
expires or it is woken when a response arrives. The current
thread joins the waiting thread which prevents the method from
returning until a response arrives or the timeout occurs.
IllegalThreadStateException
- If a waiting thread is active.public Message Identity()
Management
identity
.
Identity
in interface Management
Conductor.Identity()
public void Start()
Management
If the Conductor is in a negative processing state
(waiting
or halted
) it will enter the running
state, reconfigure itself from its Configuration source, and
source record processing will commence. If the Conductor is in the
run-to-wait
state it will clear this to
the running state; for any other positive state (running or polling
) there will be no change.
Start
in interface Management
Conductor.Start()
public void Stop()
Management
If the Conductor is in a positive processing state
it will enter the run-to-wait
state, in which it will enter the waiting
state when the current source record
completes processing. If the Conductor is in the polling
state it will immediately stop polling for
new source records. There will be no effect for any negative state.
Stop
in interface Management
Conductor.Stop()
public void Quit()
Management
Any open log file is closed. The database server is disconnected. An
exiting
processing event
is sent to all processing listeners
. The application exits with a success status
.
N.B.: If source processing is running
it is aborted.
Quit
in interface Management
Conductor.Quit()
public int Processing_State()
Management
The possible processing state values are:
Conductor.RUNNING
Conductor.POLLING
polling
for source
records to process.
Conductor.RUN_TO_WAIT
Conductor.WAITING
Conductor.HALTED
sequential failures
of source record
processing having occured, a database access failure, or some other
system error
.
The WAITING and HALTED state codes are negative; all others are positive.
Processing_State
in interface Management
public Configuration Configuration()
Management
The Configuration that is returned is a copy of the current state of
the Conductor Configuration, which is dynamically changed during
processing. All parameters named "PASSWORD" (case insensitive) will
have their values reset to Processing_Changes.MASKED_PASSWORD
.
Configuration
in interface Management
Conductor.Preconfigure(Configuration)
,
Conductor.Postconfigure(Configuration)
public Management Poll_Interval(int seconds)
Management
When the Conductor is in the polling state
it will periodically check the database sources table for
source records that are marked as unprocessed. Unprocessed source
records are used to refresh the Conductor cache of source records to
be processed. When all source records in the cache have been
processed, the Conductor will enter the polling state if the poll
interval is positive; it will enter the waiting state if the poll
interval is not positive (as if the stop request
had
been issued), or will exit if it is not connected to a Stage_Manager
at the
time.
Poll_Interval
in interface Management
seconds
- The interval, in seconds, at which the Conductor will
poll for unprocessed source records. If less than zero, zero will
be set, but the value will be reset to the Conductor
Configuration Conductor.POLL_INTERVAL_PARAMETER
value or
the Conductor.DEFAULT_POLL_INTERVAL
value if the
Configuration does contain the parameter, the next time the
Conductor is started
after having stopped
processing for any reason.
Conductor.Poll_Interval(int)
public int Poll_Interval()
Management
This value may also be obtained from the Configuration
Conductor.POLL_INTERVAL_PARAMETER
.
Poll_Interval
in interface Management
Management.Poll_Interval(int)
public Management Resolver_Default_Value(String value)
Management
Normally when the Conductor Reference_Resolver is unable to resolve a
reference it will throw an exception
and enter the halted processing state
, or
exit if it is not connected to a
Stage_Manager
at the time. If, however, the Reference_Resolver default
value
is set to a non-null String that value will be used for the
unresolved_reference instead of throwing an exception.
Resolver_Default_Value
in interface Management
value
- The default Reference_Resolver String value. If this
starts with Conductor.UNRESOLVED_REFERENCE_THROWS
(case
insensitive) null will be used.
Conductor.Resolver_Default_Value(String)
,
Reference_Resolver
public String Resolver_Default_Value()
Management
This value may also be obtained from the Configuration
Conductor.UNRESOLVED_REFERENCE_PARAMETER
.
Note, however, that the value will be Conductor.UNRESOLVED_REFERENCE_THROWS
when the actual value is
null.
Resolver_Default_Value
in interface Management
Management.Resolver_Default_Value(String)
public Management Stop_on_Failure(int failure_count)
Management
The Conductor keeps a count of
sequential source processing failures
. When this count reaches the
stop-on-failure limit the Conductor will enter the halted processing state
or exit if it is not connected to a Stage_Manager
at the
time.
N.B.: Reaching the stop-on-failure limit does not cause the
sequential failures count to be reset
.
Stop_on_Failure
in interface Management
failure_count
- The number of Conductor sequential source
processing failures at which to stop processing. If zero
sequential processing failures will never cause processing to
stop. If negative the current value will not be changed, but the
value will be reset to the Conductor Configuration Conductor.STOP_ON_FAILURE_PARAMETER
value or the Conductor.DEFAULT_STOP_ON_FAILURE
value if the Configuration
does contain the parameter, the next time the Conductor is
started
after having stopped processing for
any reason.
Management.Sequential_Failures()
,
Conductor.Stop_on_Failure(int)
public int Stop_on_Failure()
Management
This value may also be obtained from the Configuration
Conductor.STOP_ON_FAILURE_PARAMETER
Stop_on_Failure
in interface Management
Management.Stop_on_Failure(int)
public int Sequential_Failures()
Management
Other source processing success and failure counts may be obtained
from the Configuration
:
Conductor.SOURCE_SUCCESS_COUNT
Conductor.SOURCE_FAILURE_COUNT
Conductor.TOTAL_FAILURE_COUNT
Sequential_Failures
in interface Management
Management.Stop_on_Failure(int)
,
Management.Reset_Sequential_Failures()
public Management Reset_Sequential_Failures()
Management
If the Conductor is in the halted processing state
it is reset to the waiting state.
Reset_Sequential_Failures
in interface Management
Management.Stop_on_Failure(int)
,
Conductor.Reset_Sequential_Failures()
public Exception Processing_Exception()
Processing_Exception
in interface Management
public boolean Connected_to_Stage_Manager()
Management
Connected_to_Stage_Manager
in interface Management
Local_Theater
public Vector<Vector<String>> Sources()
Management
The table is expected to be delivered with the record fields in
Conductor.SOURCES_FIELD_NAMES
order, and with the records
sorted by increasing Conductor.SEQUENCE_FIELD
order.
N.B.: Only the contents of the Conductor source records cache is delivered. The contents of the database sources table may be much, much larger.
Sources
in interface Management
public Vector<Vector<String>> Procedures()
Management
The table is expected to be delivered with the record fields in
Conductor.PROCEDURES_FIELD_NAMES
order, and with the records in
processing order.
N.B.: The entire contents of the database procedures table is delivered.
Procedures
in interface Management
public Processing_Changes State()
Management
All Processing_Changes values are set except the except the flag
variables - Processing_Changes.Sources_Refreshed(boolean)
,
Processing_Changes.Procedures_Changed(boolean)
and Processing_Changes.Exiting(boolean)
- which will always be false.
State
in interface Management
Processing_Changes
public Management Add_Processing_Listener(Processing_Listener listener)
Management
The Conductor sends its processing event
notifications to all registered listeners.
Add_Processing_Listener
in interface Management
listener
- A Processing_Listener.
Processing_Listener
public boolean Remove_Processing_Listener(Processing_Listener listener)
Management
Remove_Processing_Listener
in interface Management
listener
- The Processing_Listener to be removed from the
Management list of registered listeners.
Management.Add_Processing_Listener(Processing_Listener)
public Management Add_Log_Writer(Writer writer)
Management
The Conductor writes its processing log reports, including the output from all pipeline procedures it runs, to all registered log Writers.
Add_Log_Writer
in interface Management
writer
- A Writer object.
Management.Enable_Log_Writer(Writer, boolean)
,
Management.Remove_Log_Writer(Writer)
public boolean Remove_Log_Writer(Writer writer)
Management
Remove_Log_Writer
in interface Management
writer
- A Writer object.
Management.Add_Log_Writer(Writer)
public Management Enable_Log_Writer(Writer writer, boolean enable)
Management
registered log stream Writer
.
Enable_Log_Writer
in interface Management
writer
- A Writer that has been registered to receive
Conductor log stream output. If the writer is not registered
to receive the Conductor log
stream nothing is done.enable
- If false, Conductor log stream output to the Writer is
suspended without having to unregister the Writer. If true, a
Writer that has had its log stream output suspended will begin
receiving it again.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |