1 package org.sapia.ubik.rmi.server.gc; 2 3 import org.sapia.ubik.rmi.server.*; 4 5 import java.io.IOException ; 6 import java.io.ObjectInput ; 7 import java.io.ObjectOutput ; 8 9 10 20 public class CommandGc extends RMICommand { 21 private int _count; 22 private OID[] _oids; 23 24 25 public CommandGc() { 26 } 27 28 CommandGc(OID[] oids, int count) { 29 _oids = oids; 30 _count = count; 31 } 32 33 36 public Object execute() throws Throwable { 37 int i = 0; 38 39 for (; i < _count; i++) { 40 Hub.serverRuntime.dispatchEvent(new GcEvent(getConnection() 41 .getServerAddress(), _count)); 42 Hub.serverRuntime.gc.dereference(_vmId, _oids[i]); 43 } 44 45 Hub.serverRuntime.gc.touch(_vmId); 46 47 if (Log.isDebug()) { 48 Log.debug(getClass(), "cleaned " + i + " objects"); 49 } 50 51 return null; 52 } 53 54 57 public void readExternal(ObjectInput in) 58 throws IOException , ClassNotFoundException { 59 super.readExternal(in); 60 _count = in.readInt(); 61 _oids = (OID[]) in.readObject(); 62 } 63 64 67 public void writeExternal(ObjectOutput out) throws IOException { 68 super.writeExternal(out); 69 out.writeInt(_count); 70 out.writeObject(_oids); 71 } 72 } 73 | Popular Tags |