01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.l2.msg;
06:
07: import com.tc.async.api.EventContext;
08: import com.tc.net.groups.AbstractGroupMessage;
09: import com.tc.util.Assert;
10:
11: import java.io.IOException;
12: import java.io.ObjectInput;
13: import java.io.ObjectOutput;
14: import java.util.Set;
15:
16: public class GCResultMessage extends AbstractGroupMessage implements
17: EventContext {
18: public static final int GC_RESULT = 0;
19: private Set gcedOids;
20:
21: // To make serialization happy
22: public GCResultMessage() {
23: super (-1);
24: }
25:
26: public GCResultMessage(int type, Set deleted) {
27: super (type);
28: this .gcedOids = deleted;
29: }
30:
31: protected void basicReadExternal(int msgType, ObjectInput in)
32: throws IOException, ClassNotFoundException {
33: Assert.assertEquals(GC_RESULT, msgType);
34: gcedOids = (Set) in.readObject();
35: }
36:
37: protected void basicWriteExternal(int msgType, ObjectOutput out)
38: throws IOException {
39: Assert.assertEquals(GC_RESULT, msgType);
40: // XXX::Directly serializing instead of using writeObjectIDs() to avoid HUGE messages. Since the (wrapped) set is
41: // ObjectIDSet2 and since it has optimized externalization methods, this should result in far less data written out.
42: out.writeObject(gcedOids);
43: }
44:
45: public Set getGCedObjectIDs() {
46: return gcedOids;
47: }
48:
49: public String toString() {
50: return "GCResultMessage@" + System.identityHashCode(this )
51: + " : GC Result size = "
52: + (gcedOids == null ? "null" : "" + gcedOids.size());
53: }
54:
55: }
|