[Isolate-interest] JSR-121 aggregates and links (Strawman 9)
Pete Soper
psoper@pjs.East.Sun.COM
Tue, 28 Sep 2004 09:15:41 -0400
Hi Godmar,
Aggregate is given passing mention in the public review draft but the
copy semantics of Link are well covered.
I suggest your students focus on the base package of the refactored
APIs being developed by the 121 expert group. At the end of this message is
my current proposal for EG discussion. I'm thinking very hard of a way to
simplify Link so many of the upper layers become unnecessary. The public review
draft can be used for spec reference until I've finished the new javadoc. This
is somewhat of a moving target but I think the base package may be quite stable
now and your students may find it exciting to be on the absolute edge. Also,
I'll have a collection of simple tests contributed from four sources available
for download as soon as I have time to find my old email.
This outline also reflects my argument to the EG for avoiding use of
checked exceptions, to shift more responsibility into implementations and
signal a very strong contract to users. (This was actually Doug Lea's position
long ago). The EG will also notice I pulled StringMessage after realizing this
would be a big mistake with respect to possible future interface hierarchies.
Also, I've commoned out equals and hashCode into Sendable but am not sure if
this is a good idea or not. I'm hoping Josh Bloch can give us advice.
-Pete
--------------
// Strawman 9
package jsr121x.isolate;
interface Sendable {
public boolean equals(Object o) {}
public int hashCode() {}
}
public final class Isolate implements Sendable {
public Isolate(String mainClass, String[] mainArgs) {}
public Isolate(IsolateParameters params) {}
public static Isolate currentIsolate() {}
public static Link[] currentIsolateStartLinks() {}
public static IsolateParameters currentIsolateParameters() {}
public Link newStatusLink() {}
public void start(Link[] links) throws IsolateStartException {}
public void exit(int status) {}
public void halt(int status) {}
public StatusMessage.Type getStatus() {}
}
public class CompositeMessage implements Sendable {
CompositeMessage() {}
public Message[] getComposite(Message[] msgs) {}
public static CompositeMessage newCompositeMessage(Message[] msgs) {}
}
public class DataMessage implements Sendable {
DataMessage() {}
public long size() {}
public byte[] getData() {}
public static DataMessage newDataMessage(byte[] b) {}
}
public class StatusMessage implements Sendable {
StatusMessage() {}
public final class ExitReason {
private ExitReason() {}
public final ExitReason IMPLICIT_EXIT = new ExitReason();
public final ExitReason OTHER_EXIT = new ExitReason();
public final ExitReason OTHER_HALT = new ExitReason();
public final ExitReason SELF_EXIT = new ExitReason();
public final ExitReason SELF_HALT = new ExitReason();
public final ExitReason UNCAUGHT_EXCEPTION = new ExitReason();
}
public final class Type {
private Type() {}
public final Type STARTING = new Type();
public final Type EXITING = new Type();
public final Type TERMINATED = new Type();
}
public ExitReason getExitReason() {}
public Type getType() {}
public int getExitStatus() {}
public Isolate getIsolate() {}
}
public abstract class Link implements Sendable {
Link() {}
public static Link newLink(Isolate sender, Isolate receiver) {}
public abstract Message receive();
public abstract void send(Message msg);
public abstract void close();
public abstract boolean isOpen();
public abstract boolean isSender(Isolate i);
public abstract boolean isReceiver(Isolate i);
}
public class IsolateParameters implements Sendable {
public IsolateParameters(String classname, String[] mainArgs) {}
public void setContext(String name, String value) {}
public String getContext(String name) {}
}
public class IsolateStartException extends Exception {
public IsolateStartException() {}
public IsolateStartException(String detail) {}
}