diff --git a/pmd-dcpd/etc/build.xml b/pmd-dcpd/etc/build.xml new file mode 100644 index 0000000000..1a5ec646f2 --- /dev/null +++ b/pmd-dcpd/etc/build.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pmd-dcpd/etc/rmic_go.bat b/pmd-dcpd/etc/rmic_go.bat deleted file mode 100755 index f5074d1116..0000000000 --- a/pmd-dcpd/etc/rmic_go.bat +++ /dev/null @@ -1 +0,0 @@ -rmic -classpath ..\lib\compiletimeonly\jini-core.jar;..\lib\compiletimeonly\jini-ext.jar;c:\jini-1_2_1\lib\sun-util.jar;..\build -d ..\build net.sourceforge.pmd.dcpd.JobAddedListener \ No newline at end of file diff --git a/pmd-dcpd/src/net/sourceforge/pmd/dcpd/DCPDWorker.java b/pmd-dcpd/src/net/sourceforge/pmd/dcpd/DCPDWorker.java index 30144e9365..abf94fc0d2 100644 --- a/pmd-dcpd/src/net/sourceforge/pmd/dcpd/DCPDWorker.java +++ b/pmd-dcpd/src/net/sourceforge/pmd/dcpd/DCPDWorker.java @@ -16,31 +16,12 @@ import java.rmi.MarshalledObject; public class DCPDWorker { - public class MyListener implements RemoteEventListener { - - public MyListener() {} - - public void notify(RemoteEvent event) throws UnknownEventException, RemoteException { - System.out.println("HOWDY!"); - try { - Job job = (Job)space.take(new Job("test"), null, 1000); - if (job == null) { - System.out.println("No job found"); - } else { - System.out.println("job = " + job.name); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - private JavaSpace space; public DCPDWorker() { try { space = Util.findSpace("mordor"); - space.notify(new Job("test"), null, new MyListener(), Lease.FOREVER, null); + space.notify(new Job("test"), null, new JobAddedListener(), Lease.FOREVER, null); } catch (Exception e) { e.printStackTrace(); } diff --git a/pmd-dcpd/src/net/sourceforge/pmd/dcpd/JobAddedListener.java b/pmd-dcpd/src/net/sourceforge/pmd/dcpd/JobAddedListener.java new file mode 100644 index 0000000000..57773a4cbc --- /dev/null +++ b/pmd-dcpd/src/net/sourceforge/pmd/dcpd/JobAddedListener.java @@ -0,0 +1,38 @@ +/* + * User: tom + * Date: Aug 23, 2002 + * Time: 5:19:47 PM + */ +package net.sourceforge.pmd.dcpd; + +import net.jini.core.event.RemoteEventListener; +import net.jini.core.event.RemoteEvent; +import net.jini.core.event.UnknownEventException; +import net.jini.space.JavaSpace; + +import java.rmi.RemoteException; +import java.rmi.server.UnicastRemoteObject; + +public class JobAddedListener extends UnicastRemoteObject implements RemoteEventListener { + private JavaSpace space; + + public JobAddedListener() throws RemoteException {} + + public JobAddedListener(JavaSpace space) throws RemoteException { + this.space = space; + } + + public void notify(RemoteEvent event) throws UnknownEventException, RemoteException { + System.out.println("HOWDY!"); + try { + Job job = (Job)space.take(new Job("test"), null, 1000); + if (job == null) { + System.out.println("No job found"); + } else { + System.out.println("job = " + job.name); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +}