Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 May 2002 18:30:23 +0200
From:      "Amir Bukhari" <>
To:        "'Ernst de Haan'" <>, <>
Subject:   AW: RMI and Thread with jdk1.3.1
Message-ID:  <000001c1fdc0$250be810$3b00a8c0@C39>
In-Reply-To: <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
I use freebsd 4.5 StABLE.

this the java version I use linux-jdk1.3.1 :
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Classic VM (build 1.3.1_02-b02, green threads, nojit).

Note : I have also tried the port jdk1.3.1p5

Sorry but I cant put the source code, because it very big ( more than
3000 lines), but I can put
the main class, which provide RMI. I have build it with javac

I know that java is independet plattform, therefor my programm should
work also under freebsd,
 that mean there something wrong with my installation or I have missing
to install something, there is a
configuration I must do before using java,
 but I have installed java from the port collection, which install also

My main Program (Server) do the following:
1- run RMI Regestry at port 1099
2- then wait for a connection from the client, which a specified
3- when it received command from the client it then start the simulation
Program, which should be run as Thread.

Clien Site:
the client only send the command to the server.

Source code :
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.util.*;

class RMISimServerImpl extends UnicastRemoteObject
        implements RMISimServerInterface
  int STOP =3D 1, START =3D 2 , PAUSE =3D 3, QUIT =3D 4, CONTINUE =3D 5;
  RMISimProtokol protokol =3D new RMISimProtokol();
  EventSimPar arg =3D new EventSimPar();
  String modell;
  int cmd =3D -1;

  public RMISimServerImpl() throws RemoteException {}

  public RMISimServerImpl(String filename, EventSimPar argument) throws
RemoteException {
    modell =3D filename;
    arg =3D argument;

  public void SendCommand(int command) throws RemoteException
    cmd =3D command;

    System.out.println("Command was Send"); // as Tes, but this was not
displayed when i have sended a command !!

  public void SendEvent(RMIEvent rmievent) throws RemoteException
  public void prozessCommand() {
    int command =3D -1;
    //System.out.println("Waiting for command");
    while(command =3D=3D -1) {

      if (cmd =3D=3D START) {
        EventSim evtSim =3D new EventSim(modell, arg); // this is The
Simulation Programm which run as Thread
        cmd =3D -1;
      } else if (cmd =3D=3D QUIT) {
       command =3D 0;
      } else if (cmd =3D=3D STOP) {
      }else if (cmd =3D=3D PAUSE) {
      }else if (cmd =3D=3D CONTINUE) {

  public void runRMI() {
     //System.out.println("Ready for RMI's ");
     //System.setSecurityManager(new RMISecurityManager());
     try {
       System.out.print("Registering RMISimServer");
       //RMISimServerImpl rmiserver =3D new RMISimServerImpl();
       System.out.println("   Done.");
     } catch (Exception e) {



class RMISimProtokol
   static int command =3D -1;
   int STOP =3D 1, START =3D 2 , PAUSE =3D 3, QUIT=3D 4;
   RMIEvent rmiEvent;
   static Queue inputVectors =3D new Queue();

   public RMISimProtokol() {}

   public void SetCommand(int cmd) {
      command =3D cmd;
  public void SetEvent(RMIEvent rmievnt)
    rmiEvent =3D rmievnt;

  public RMIEvent GetEvent() {
      RMIEvent result =3D null;
      try {
          result =3D (RMIEvent) inputVectors.dequeue();
      } catch (Exception e) {
        System.out.println("GetEvent error: " + e.toString());
      return result;

  public int getCommand() {
     return command;

> -----Urspr=FCngliche Nachricht-----
> Von: Ernst de Haan []
> Gesendet: 17 May, 2002 08:42 =D5
> An: Amir Bukhari; freebsd-java
> Betreff: Re: RMI and Thread with jdk1.3.1
> Amir,
> If you want people to help you, you will need to provide more detailed
> information:
> 1) FreeBSD version (Use 'uname -a')
> 2) Java version (Use 'java -version')
> 3) A test case, if possible. Perhaps you can provide the source code
> the
> server and client programs with an Ant build file or so?
> Ernst
> On Friday 17 May 2002 00:14, Amir Bukhari wrote:
> > Hi,
> > I am a new user of FreeBSD; therefore I have no experience with
> > fundamental.
> > Ok, I have Install Java 1.3.1 and I have tested it with a program,
> > I have written under Linux,
> > But It seem to it is not working, this program implement RMI and
> > in Java. It Contain Server and Client program.
> > Under windows, Linux, Solaris work very good, but under FreeBSD not
> > correctly "this mean it run but not give any output which  I wait
> > it"
> >
> >
> > If someone has an idea about this or similar, please E-Mail me.
> >
> > Amir
> --
> Ernst de Haan
> EuroNet Internet B.V.
>     "Come to me all who are weary and burdened
>         and I will give you rest" -- Jesus Christ

To Unsubscribe: send mail to
with "unsubscribe freebsd-java" in the body of the message

Want to link to this message? Use this URL: <$250be810$3b00a8c0>