package edu.vt.marian.uip; import java.io.*; import java.net.*; import java.util.*; import edu.vt.marian.common.*; /** class name: server_uip_call_in_thread class description: this thread will pass the rpc_function to the server_uip_thread to send to corresponding client_uip, using thread can avoid possible deadlock caused by reader_writer_mutex when a thread is killed while it's executing a reader or writer method, this can also avoid blocking the caller when it takes long time for the function to be passed to the client_uip

uses the services of class(es): designer(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu) implementator(s): finished time: known bugs: JDK version: 1.1.5 side effects: */ public class server_uip_call_in_thread extends Thread { /** this is just used for debugging */ Debug debug; /** this is the client_id used to indicate which client_uip to send the function to */ private int client_id; /** this is the function to send to the client uip */ private rpc_function rf; /** this is the server uip thread to pass the function to */ private server_uip_thread sut; /** method description: this constructor will create a server_uip_call_in _thread object based on the information specified in the parameters

uses the services of class(es): input parameter(s): client_id --- specifies which client_uip to send this function rf -- the function need to be sent to the client_uip sut -- the function and the client_id will be passed to this object to send to corresponding client_uip debug -- used for debugging output parameter(s): none return value: none synchronization consideration: none */ public server_uip_call_in_thread(int client_id, rpc_function rf, server_uip_thread sut, Debug debug) { this.debug = debug; // implementation required this.client_id = client_id; this.rf = rf; this.sut = sut; } /** method description: this method of the thread will pass the function to the server_uip_thread to send to corresponding client_uip

uses the services of class(es): input parameter(s): none output parameter(s): none return value: none synchronization consideration: none */ public void run() { // implementation required if ((rf == null) || (sut == null)) { // invalid parameter debug.dumpTrace("class server_uip_call_in_thread, method run, function or server uip thread is null"); return; } if (sut.get_status() == sut.EXIT) { // can't pass function in this case debug.dumpTrace("class server_uip_call_in_thread, method run, function received after server uip thread exit"); return; } // server uip is ok here sut.rpc_call(client_id, rf); } }