diff options
| author | Paul Buetow <paul@buetow.org> | 2008-06-03 16:41:37 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-06-03 16:41:37 +0000 |
| commit | 11af1c9fa7fe66e10de0a92878311b4e22befb0f (patch) | |
| tree | 8dfc7af2ec18eb5889327426bc6fdb7379a3feba /sources/protocols/VSAbstractProtocol.java | |
| parent | f7bdf8a7f6ebd43bfacc22eeeda3eb52bf50efd7 (diff) | |
made future serialized class versions backwards compatible.
Diffstat (limited to 'sources/protocols/VSAbstractProtocol.java')
| -rw-r--r-- | sources/protocols/VSAbstractProtocol.java | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/sources/protocols/VSAbstractProtocol.java b/sources/protocols/VSAbstractProtocol.java index 9999f62..39d338a 100644 --- a/sources/protocols/VSAbstractProtocol.java +++ b/sources/protocols/VSAbstractProtocol.java @@ -111,15 +111,15 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { if (hasOnServerStart) { if (isServer) { currentContextIsServer(true); - if (!isServerInitialized) - onInit(); + if (!isServerInitialized) + onInit(); onServerStart(); } } else { if (isClient) { currentContextIsServer(false); - if (!isClientInitialized) - onInit(); + if (!isClientInitialized) + onInit(); onClientStart(); } } @@ -132,13 +132,13 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { if (isClient) { currentContextIsServer(false); onClientInit(); - isClientInitialized = true; + isClientInitialized = true; } if (isServer) { currentContextIsServer(true); onServerInit(); - isServerInitialized = true; + isServerInitialized = true; } } @@ -173,15 +173,15 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { if (isServer) { currentContextIsServer(true); - if (!isServerInitialized) - onInit(); + if (!isServerInitialized) + onInit(); onServerRecv(message); } if (isClient) { currentContextIsServer(false); - if (!isClientInitialized) - onInit(); + if (!isClientInitialized) + onInit(); onClientRecv(message); } } @@ -408,7 +408,14 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { ObjectOutputStream objectOutputStream) throws IOException { super.serialize(serialize, objectOutputStream); + + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(new Boolean(hasOnServerStart)); + + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); } /* (non-Javadoc) @@ -424,7 +431,13 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { if (VSSerialize.DEBUG) System.out.println("Deserializing: VSAbstractProtocol"); + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); + this.hasOnServerStart = ((Boolean) objectInputStream.readObject()).booleanValue(); + + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); } } |
