ActivatableThisOrThatServerImplpublic class ActivatableThisOrThatServerImpl extends Activatable implements ThisOrThatServerActivatableThisOrThatServerImpl: A remote implementation of ThisOrThatServer
which allows for automated (re)activation of the server object.
Example 3-5, Java Enterprise in a Nutshell, 1st ed.
Author: Jim Farley |
Fields Summary |
---|
private String | myName |
Constructors Summary |
---|
public ActivatableThisOrThatServerImpl(String name, String src, int port)
// "Regular" constructor used to create a "pre-activated" server
// Register and export object (on random open port)
super(src, new MarshalledObject(name), false, port);
// Save name
myName = name;
System.out.println("Initialization constructor called.");
| protected ActivatableThisOrThatServerImpl(ActivationID id, MarshalledObject arg)
// Export this object with the given activation id, on random port
super(id, 0);
System.out.println("Activating a server");
// Check incoming data passed in with activation request
try {
Object oarg = arg.get();
if (oarg instanceof String) {
myName = (String)oarg;
}
else {
System.out.println("Unknown argument received on activation: " + oarg);
}
}
catch(Exception e) {
System.out.println("Error retrieving argument to activation");
}
System.out.println("(Re)activation constructor called.");
|
|