next up previous
Next: Management Server Java Code Up: Pseudocode Previous: C interface to Management

Management Client Java Code

 

class ManagementClient {

 

  private LocalLog LLog;

 

  //These exist to allow C code to invoke a JVM 

  //and cause it to spawn a thread which runs the RMI server. 

  //Implementation is straightforward, hence skipped here 

  public int initClientThread() { 

  } 

  public int killClientThread() { 

  }

 

  public int manageFunctionInvocation(String ComponentName, 

                                      String FunctionName, 

                                      String KeyFunctionArg) { 

    if (FunctionName.equals("Main")) { 

      LLog = new LocalLog(); 

      int PortNumber = initManagementClient_RMI_Server(); 

      ManagementServer.reportCreation(ComponentName, PortNumber); 

                                           //RMI call to server 

    }

    writeLocalLogEntry("Invocation", 

                       ComponentName, 

                       FunctionName, 

                       KeyFunctionArg); 

    return; 

  }

 

  public int manageFunctionTermination(String ComponentName, 

                                       String FunctionName, 

                                       String KeyFunctionArg) {

    writeLocalLogEntry("Termination", 

                       ComponentName, 

                       FunctionName, 

                       KeyFunctionArg); 

    flushLocalLog(); 

    if (FunctionName.equals("Main")) { 

      ManagementServer.reportDestruction(ComponentName, PortNumber);

                                              //RMI call to server 

    }

  }

 

  private int writeLocalLogEntry(String EventType, 

                                 String ComponentName, 

                                 String FunctionName, 

                                 String KeyFunctionArg) { 

    LLog.write(EventType, 

               ComponentName, 

               FunctionName, 

               KeyFunctionArg); 

    if(LLog.isFull()) { 

      flushLocalLog(); 

    } 

  }

 

  public int flushLocalLog() { 

  //this function is exported to Server via RMI 

    ManagementServer.writeRemoteLogEntries(LLog); 

                           //RMI call to server 

    LLog.reset(); 

  }

 

class LocalLog { 

  private (some data structure) 

 

  public boolean isFull() { 

  } 

 

  public int write(String EventType, 

                   String ComponentName, 

                   String FunctionName, 

                   String KeyFunctionArg) { 

  }

 

  public int reset() { 

  } 

 

  public int synchronize(RemoteLog MasterLog) { 

    //called by server when LocalLog is sent 

    call some functions in MasterLog 

  } 

}



David L. Roxe
1998-10-02