From 141a1a049a6160d9bba46a2f8858a2652ccfca37 Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Fri, 23 Aug 2002 21:37:28 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@769 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd-dcpd/etc/build.xml | 44 +++++++++++++++++++ pmd-dcpd/etc/rmic_go.bat | 1 - .../net/sourceforge/pmd/dcpd/DCPDWorker.java | 21 +-------- .../pmd/dcpd/JobAddedListener.java | 38 ++++++++++++++++ 4 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 pmd-dcpd/etc/build.xml delete mode 100755 pmd-dcpd/etc/rmic_go.bat create mode 100644 pmd-dcpd/src/net/sourceforge/pmd/dcpd/JobAddedListener.java 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(); + } + } +}