forked from phoedos/pmd
*** empty log message ***
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@769 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
44
pmd-dcpd/etc/build.xml
Normal file
44
pmd-dcpd/etc/build.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<project name="pmd-dcpd" default="compile" basedir="../">
|
||||
|
||||
<property name="lib" value="lib\"/>
|
||||
<property name="compiletimelibsdir" value="${lib}/compiletimeonly"/>
|
||||
<property name="src" value="src\"/>
|
||||
<property name="build" value="build\"/>
|
||||
<property name="jar" value="pmd-dcpd-0.1.jar"/>
|
||||
<property name="build.compiler" value="jikes"/>
|
||||
|
||||
<target name="delete">
|
||||
<delete dir="${build}"/>
|
||||
<delete file="${lib}\${jar}"/>
|
||||
<mkdir dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile">
|
||||
<javac deprecation="true"
|
||||
debug="true"
|
||||
optimize="false"
|
||||
srcdir="${src}"
|
||||
destdir="${build}">
|
||||
<classpath>
|
||||
<pathelement location="${compiletimelibsdir}/jini-core.jar"/>
|
||||
<pathelement location="${compiletimelibsdir}/jini-ext.jar"/>
|
||||
<pathelement location="${lib}/pmd-0.9.jar"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="rmic">
|
||||
<rmic base="${build}" classname="net.sourceforge.pmd.dcpd.JobAddedListener" >
|
||||
<classpath>
|
||||
<pathelement location="${compiletimelibsdir}/jini-core.jar"/>
|
||||
<pathelement location="${compiletimelibsdir}/jini-ext.jar"/>
|
||||
</classpath>
|
||||
</rmic>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="delete,compile,rmic"/>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
|
@ -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
|
@ -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();
|
||||
}
|
||||
|
38
pmd-dcpd/src/net/sourceforge/pmd/dcpd/JobAddedListener.java
Normal file
38
pmd-dcpd/src/net/sourceforge/pmd/dcpd/JobAddedListener.java
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user