From owner-freebsd-java Fri May 17 9:28:33 2002 Delivered-To: freebsd-java@freebsd.org Received: from mailgate.rz.uni-karlsruhe.de (mailgate.rz.uni-karlsruhe.de [129.13.64.97]) by hub.freebsd.org (Postfix) with ESMTP id 6845F37B40B for ; Fri, 17 May 2002 09:28:21 -0700 (PDT) Received: from C39 (hadic039a.hadiko.uni-karlsruhe.de [172.20.46.159]) by mailgate.rz.uni-karlsruhe.de with esmtp (Exim 3.33 #1) id 178kaZ-0005al-00; Fri, 17 May 2002 18:28:19 +0200 From: "Amir Bukhari" To: "'Ernst de Haan'" , Subject: AW: RMI and Thread with jdk1.3.1 Date: Fri, 17 May 2002 18:30:23 +0200 Message-ID: <000001c1fdc0$250be810$3b00a8c0@C39> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1256" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal In-Reply-To: <200205170841.34641.ernsth@nl.euro.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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 dependeries. 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 command. 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.*; import java.net.*; 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 { protokol.SetEvent(rmievent); } public void prozessCommand() { int command =3D -1; //System.out.println("Waiting for command"); while(command =3D=3D -1) { if (cmd =3D=3D START) { protokol.SetCommand(cmd); EventSim evtSim =3D new EventSim(modell, arg); // this is The Simulation Programm which run as Thread evtSim.start(); cmd =3D -1; } else if (cmd =3D=3D QUIT) { protokol.SetCommand(cmd); command =3D 0; } else if (cmd =3D=3D STOP) { protokol.SetCommand(cmd); }else if (cmd =3D=3D PAUSE) { protokol.SetCommand(cmd); }else if (cmd =3D=3D CONTINUE) { protokol.SetCommand(cmd); } } System.exit(0); } 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(); LocateRegistry.createRegistry(1099); Naming.bind("rmi://:1099/RMISimServerImpl",this); System.out.println(" Done."); } catch (Exception e) { System.out.println(e.toString()); System.exit(1); } prozessCommand(); } } 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; inputVectors.enqueue(rmievnt); } public RMIEvent GetEvent() { RMIEvent result =3D null; try { if(!inputVectors.isQueueEmpty()) 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 [mailto:ernsth@nl.euro.net] > Gesendet: 17 May, 2002 08:42 =D5 > An: Amir Bukhari; freebsd-java > Betreff: Re: RMI and Thread with jdk1.3.1 >=20 > Amir, >=20 > 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 to > the > server and client programs with an Ant build file or so? >=20 > Ernst >=20 > On Friday 17 May 2002 00:14, Amir Bukhari wrote: > > Hi, > > I am a new user of FreeBSD; therefore I have no experience with FreeBSD > > fundamental. > > Ok, I have Install Java 1.3.1 and I have tested it with a program, which > > I have written under Linux, > > But It seem to it is not working, this program implement RMI and Thread > > in Java. It Contain Server and Client program. > > Under windows, Linux, Solaris work very good, but under FreeBSD not work > > correctly "this mean it run but not give any output which I wait for > > it" > > > > > > If someone has an idea about this or similar, please E-Mail me. > > > > Amir >=20 > -- > Ernst de Haan > EuroNet Internet B.V. >=20 > "Come to me all who are weary and burdened > and I will give you rest" -- Jesus Christ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message