|
|||||||||
| Home >> All >> org >> ematgine >> [ threads overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.ematgine.threads
Class ematgine_thread

java.lang.Objectorg.ematgine.threads.ematgine_thread
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.util.EventListener, java.lang.Runnable
- Direct Known Subclasses:
- ematgine_service
- public abstract class ematgine_thread
- extends java.lang.Object
- implements java.lang.Runnable, java.awt.event.ActionListener
- extends java.lang.Object
This class is an abstract to provide communication service to all ematgine services and administrative threads
| Field Summary | |
protected java.util.LinkedList |
internal_requests
simple LinkedList for internal service communication |
protected boolean |
killed
True to kill the eMATgine service |
protected int |
PDU_number
number of the PDU sent by the service |
protected java.util.Hashtable |
queues
communication channel between threads table |
protected boolean |
runner
False to stop the eMATgine service |
protected java.util.Hashtable |
semaphores
semaphores table for synchronisation between threads |
protected boolean |
stopped
True to stop the eMATgine service |
protected java.lang.String |
sub_thread_name
Thread name |
protected java.lang.Thread |
the_thread
the eMATgine Thread |
protected java.lang.String |
thread_name
Thread name |
private java.util.Vector |
waiting_confirmation_response_PDU
A collection of sent PDU : waiting confirmation and/or response |
private java.util.Vector |
waiting_PDU
A collection of waiting PDU to be sent |
| Constructor Summary | |
ematgine_thread()
Constructors |
|
ematgine_thread(java.util.Hashtable queueParams,
java.util.Hashtable semaphoreParams)
Constructors |
|
| Method Summary | |
void |
acquire_semaphore(java.lang.String semaphore_name)
acquire semaphore |
void |
actionPerformed(java.awt.event.ActionEvent event)
Wait for actions performed on the interface |
protected void |
addWaitingPDU(org.ematgine.utils.requests.PDU_request pdu)
declare a PDU to be waiting for a confirmation or response |
void |
attempt_semaphore(java.lang.String semaphore_name,
int msec)
attempt to acquire semaphore during msec |
void |
display_hashtable(java.util.Hashtable aHashtable)
display a hashtable |
private void |
displayawaitedPDU()
Description of the Method |
protected void |
displayQueuesSize()
Description of the Method |
java.lang.String |
get_date_toString()
define a date as a string |
org.ematgine.utils.requests.PDU_request |
get_PDU(java.lang.String from)
get a PDU from another thread |
java.util.Vector |
get_several_PDU(java.lang.String from,
int nb)
This method shall be used in the run() method of the main thread of the service in order to : get all the arrived PDU and send all the PDU that could not have been sent previously |
java.lang.String |
get_sub_thread_name()
Get the sub thread name for internal thread of service |
java.lang.String |
get_thread_name()
Get the thread name service |
protected org.ematgine.utils.requests.PDU_request |
getWaitingPDU(int pdu_nb)
declare a PDU to be waiting for a confirmation or response |
void |
increment_PDU_number()
increment the PDU number |
void |
internalService_addPDURequest(org.ematgine.utils.requests.PDU_request user_request)
|
org.ematgine.utils.requests.PDU_request |
internalService_getPDURequest()
|
int |
internalService_PDURequest_size()
|
protected int |
isAwaited(org.ematgine.utils.requests.PDU_request the_pdu)
This functions treats awited PDU 1) it checks if the recevied PDU is awaited 2) if not awaited, it returns -1 3) if the PDU is awaited 3a) it is the only PDU left that is awaited, it returns its position in PDU queue 3b) there are other PDU left, it return -1 |
protected int |
numberOfWaitingPDU()
declare a PDU to be waiting for a confirmation or response |
void |
poll_PDU(org.ematgine.utils.requests.PDU_request the_pdu)
polls the PDU in waiting_PDU queue. |
void |
print_screen(java.lang.String content)
print to the screen |
void |
println_access_log(java.lang.Exception content)
println an exception to the access log |
void |
println_access_log(java.lang.String content)
println a string to the access log |
void |
println_error_log(java.lang.Exception content)
println an exception to the error log |
void |
println_error_log(java.lang.String content)
println a string to the error log |
void |
println_pdu_log(java.lang.String from,
org.ematgine.utils.requests.PDU_request content)
println a PDU to the pdu log |
void |
println_screen(java.lang.Exception content)
println to the screen |
void |
println_screen(java.lang.String content)
println to the screen |
void |
release_semaphore(java.lang.String semaphore_name)
release semaphore |
protected void |
removeWaitingPDU(int pdu_nb)
remove a PDU waiting for a confirmation or response |
void |
send_PDU_mail_with_filenames(java.util.Vector filenames,
java.lang.String identity,
int priority,
java.lang.String part0)
send a mail with all the files defined attached to the mail |
void |
send_PDU_mail_with_html_files(java.util.Vector transformed_html_files,
java.lang.String identity,
int priority,
java.lang.String part0)
send a mail with the HTML files attached |
void |
send_PDU_mail_with_part_of_file(java.lang.String filename,
java.lang.String identity,
java.lang.String part0,
java.lang.String priority,
long j_mailboxSize,
long mailboxSize,
int j,
int nbOfParts)
Description of the Method |
java.lang.String |
send_PDU_without_polling(org.ematgine.utils.requests.PDU_request the_pdu)
send a PDU to another thread without polling the request in queue to wait response |
java.lang.String |
send_PDU(org.ematgine.utils.requests.PDU_request the_pdu,
int msec)
send a PDU to another thread |
java.lang.String |
send_PDU(java.lang.String to,
org.ematgine.utils.requests.PDU_request the_pdu)
send a PDU to another thread |
java.lang.String |
send_PDU(java.lang.String to,
org.ematgine.utils.requests.PDU_request the_pdu,
int msec)
send a PDU to another thread |
boolean |
send_waiting_PDU(org.ematgine.utils.requests.PDU_request the_pdu,
int msec)
send a PDU in waiting_PDU queue to another thread |
private void |
send_waiting_PDUs()
This method shall be called to send all the PDU that could not have been sent previously. |
void |
set_priority(int prio)
set priority of the thread |
void |
set_sub_thread_name(java.lang.String name)
Set the sub thread name service |
void |
set_thread_name(java.lang.String name)
Set the thread name service |
void |
sleep(int msec)
make the thread to sleep |
void |
start()
start the thread |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.lang.Runnable |
run |
| Field Detail |
queues
protected java.util.Hashtable queues
- communication channel between threads table
semaphores
protected java.util.Hashtable semaphores
- semaphores table for synchronisation between threads
internal_requests
protected java.util.LinkedList internal_requests
- simple LinkedList for internal service communication
the_thread
protected java.lang.Thread the_thread
- the eMATgine Thread
thread_name
protected java.lang.String thread_name
- Thread name
sub_thread_name
protected java.lang.String sub_thread_name
- Thread name
PDU_number
protected int PDU_number
- number of the PDU sent by the service
killed
protected boolean killed
- True to kill the eMATgine service
stopped
protected boolean stopped
- True to stop the eMATgine service
runner
protected boolean runner
- False to stop the eMATgine service
waiting_PDU
private java.util.Vector waiting_PDU
- A collection of waiting PDU to be sent
waiting_confirmation_response_PDU
private java.util.Vector waiting_confirmation_response_PDU
- A collection of sent PDU : waiting confirmation and/or response
| Constructor Detail |
ematgine_thread
public ematgine_thread()
- Constructors
ematgine_thread
public ematgine_thread(java.util.Hashtable queueParams, java.util.Hashtable semaphoreParams)
- Constructors
| Method Detail |
set_thread_name
public void set_thread_name(java.lang.String name)
- Set the thread name service
set_sub_thread_name
public void set_sub_thread_name(java.lang.String name)
- Set the sub thread name service
get_thread_name
public java.lang.String get_thread_name()
- Get the thread name service
get_sub_thread_name
public java.lang.String get_sub_thread_name()
- Get the sub thread name for internal thread of service
internalService_PDURequest_size
public int internalService_PDURequest_size()
internalService_addPDURequest
public void internalService_addPDURequest(org.ematgine.utils.requests.PDU_request user_request)
internalService_getPDURequest
public org.ematgine.utils.requests.PDU_request internalService_getPDURequest() throws java.lang.InterruptedException
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- Wait for actions performed on the interface
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
start
public final void start()
- start the thread
set_priority
public final void set_priority(int prio)
- set priority of the thread
sleep
public void sleep(int msec)
- make the thread to sleep
get_date_toString
public java.lang.String get_date_toString()
- define a date as a string
display_hashtable
public void display_hashtable(java.util.Hashtable aHashtable)
- display a hashtable
attempt_semaphore
public void attempt_semaphore(java.lang.String semaphore_name, int msec)
- attempt to acquire semaphore during msec
acquire_semaphore
public void acquire_semaphore(java.lang.String semaphore_name)
- acquire semaphore
release_semaphore
public void release_semaphore(java.lang.String semaphore_name)
- release semaphore
increment_PDU_number
public void increment_PDU_number()
- increment the PDU number
send_waiting_PDUs
private void send_waiting_PDUs()
- This method shall be called to send all the PDU that could not have been
sent previously. (don't forget to limit the number of try in one pass: TBD)
poll_PDU
public void poll_PDU(org.ematgine.utils.requests.PDU_request the_pdu)
- polls the PDU in waiting_PDU queue. This PDU could not have been sent
send_waiting_PDU
public final boolean send_waiting_PDU(org.ematgine.utils.requests.PDU_request the_pdu, int msec)
- send a PDU in waiting_PDU queue to another thread
send_PDU
public final java.lang.String send_PDU(java.lang.String to, org.ematgine.utils.requests.PDU_request the_pdu)
- send a PDU to another thread
send_PDU_without_polling
public final java.lang.String send_PDU_without_polling(org.ematgine.utils.requests.PDU_request the_pdu)
- send a PDU to another thread without polling the request in queue to wait
response
send_PDU
public final java.lang.String send_PDU(org.ematgine.utils.requests.PDU_request the_pdu, int msec)
- send a PDU to another thread
send_PDU
public final java.lang.String send_PDU(java.lang.String to, org.ematgine.utils.requests.PDU_request the_pdu, int msec)
- send a PDU to another thread
get_PDU
public final org.ematgine.utils.requests.PDU_request get_PDU(java.lang.String from)
- get a PDU from another thread
get_several_PDU
public java.util.Vector get_several_PDU(java.lang.String from, int nb)
- This method shall be used in the run() method of the main thread of the
service in order to : get all the arrived PDU and send all the PDU that
could not have been sent previously
print_screen
public final void print_screen(java.lang.String content)
- print to the screen
println_screen
public final void println_screen(java.lang.String content)
- println to the screen
println_screen
public final void println_screen(java.lang.Exception content)
- println to the screen
println_error_log
public final void println_error_log(java.lang.Exception content)
- println an exception to the error log
println_error_log
public final void println_error_log(java.lang.String content)
- println a string to the error log
println_access_log
public final void println_access_log(java.lang.Exception content)
- println an exception to the access log
println_access_log
public final void println_access_log(java.lang.String content)
- println a string to the access log
println_pdu_log
public final void println_pdu_log(java.lang.String from, org.ematgine.utils.requests.PDU_request content)
- println a PDU to the pdu log
send_PDU_mail_with_html_files
public final void send_PDU_mail_with_html_files(java.util.Vector transformed_html_files, java.lang.String identity, int priority, java.lang.String part0)
- send a mail with the HTML files attached
send_PDU_mail_with_filenames
public final void send_PDU_mail_with_filenames(java.util.Vector filenames, java.lang.String identity, int priority, java.lang.String part0)
- send a mail with all the files defined attached to the mail
send_PDU_mail_with_part_of_file
public final void send_PDU_mail_with_part_of_file(java.lang.String filename, java.lang.String identity, java.lang.String part0, java.lang.String priority, long j_mailboxSize, long mailboxSize, int j, int nbOfParts)
- Description of the Method
addWaitingPDU
protected void addWaitingPDU(org.ematgine.utils.requests.PDU_request pdu)
- declare a PDU to be waiting for a confirmation or response
getWaitingPDU
protected org.ematgine.utils.requests.PDU_request getWaitingPDU(int pdu_nb)
- declare a PDU to be waiting for a confirmation or response
removeWaitingPDU
protected void removeWaitingPDU(int pdu_nb)
- remove a PDU waiting for a confirmation or response
numberOfWaitingPDU
protected int numberOfWaitingPDU()
- declare a PDU to be waiting for a confirmation or response
isAwaited
protected int isAwaited(org.ematgine.utils.requests.PDU_request the_pdu)
- This functions treats awited PDU 1) it checks if the recevied PDU is
awaited 2) if not awaited, it returns -1 3) if the PDU is awaited 3a) it is
the only PDU left that is awaited, it returns its position in PDU queue 3b)
there are other PDU left, it return -1
displayawaitedPDU
private void displayawaitedPDU()
- Description of the Method
displayQueuesSize
protected void displayQueuesSize()
- Description of the Method
|
|||||||||
| Home >> All >> org >> ematgine >> [ threads overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.ematgine.threads.ematgine_thread