|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ServerObject
The ServerObject interface prescribes methods which must be defined in any object in the mudlib. Specifically, it wants objects to flag when they are destructed so that the server will stop keeping track of them, and also so that other objects in the mudlib can stop keeping track of them. It is important to remember with Java that destructing an object does not get rid of all references to it. You need to get rid of all references to it in order to delete it from memory. A good mudlib thus will always check if an object is destructed before using it in code and it will remove references to destructed objects. For example:
MudObject some_object;
public void doSomething() {
if( some_object.getDestructed() ) {
some_object = null;
return;
}
some_object.getSomethingDoneTo();
}
For people used to LPC, the above code would be roughly
the same as doing:
object some_object;
void do_something() {
if( !some_object ) {
return;
}
some_object->get_something_done_to();
}
Created: 27 September 1996
| Method Summary | |
|---|---|
void |
destruct()
This method should make it such that getDestructed() returns true and the object is no longer valid for the system. |
boolean |
getDestructed()
Signifies that thsi object has been marked for destruction and that all references to this object should be nulled out as soon as they notice. |
java.lang.String |
getObjectId()
This method is used to find the unique object id for this object. |
void |
processEvent()
Triggered every server cycle by the server to see if this object has an event to process. |
void |
setObjectId(java.lang.String id)
This method should be used to set the object's unique object id which the object should be keeping track of. |
| Method Detail |
|---|
void destruct()
getDestructed()void processEvent()
boolean getDestructed()
java.lang.String getObjectId()
setObjectId(java.lang.String)void setObjectId(java.lang.String id)
public final void setObjectId(String id) {
if( object_id != null ) {
return;
}
object_id = id;
}
id - the unique value to which the id is being setgetObjectId()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||