65 |
obj.manager.startServer(); |
obj.manager.startServer(); |
66 |
} |
} |
67 |
|
|
68 |
|
// FIX ME: I haven't handle force parameter |
69 |
|
public static boolean unexportObject(UnicastServerRef obj, boolean force) { |
70 |
|
objects.remove(obj.objid); |
71 |
|
obj.manager.stopServer(); |
72 |
|
return true; |
73 |
|
} |
74 |
|
|
75 |
private static synchronized void startDGC() { |
private static synchronized void startDGC() { |
76 |
if (dgc == null) { |
if (dgc == null) { |
77 |
try { |
try { |
107 |
UnicastServerRef uref = (UnicastServerRef)objects.get(objid); |
UnicastServerRef uref = (UnicastServerRef)objects.get(objid); |
108 |
Object returnval; |
Object returnval; |
109 |
int returncode = RETURN_ACK; |
int returncode = RETURN_ACK; |
110 |
|
// returnval is from Method.invoke(), so we must check the return class to see |
111 |
|
// if it's primitive type |
112 |
|
Class returncls = null; |
113 |
if (uref != null) { |
if (uref != null) { |
114 |
try { |
try { |
115 |
// Dispatch the call to it. |
// Dispatch the call to it. |
116 |
returnval = uref.incomingMessageCall(conn, method, hash); |
returnval = uref.incomingMessageCall(conn, method, hash); |
117 |
|
returncls = uref.getMethodReturnType(method, hash); |
118 |
} |
} |
119 |
catch (Exception e) { |
catch (Exception e) { |
120 |
returnval = e; |
returnval = e; |
132 |
|
|
133 |
out.writeByte(returncode); |
out.writeByte(returncode); |
134 |
(new UID()).write(out); |
(new UID()).write(out); |
135 |
out.writeObject(returnval); |
if(returnval != null && returncls != null) |
136 |
|
((RMIObjectOutputStream)out).writeValue(returnval, returncls); |
137 |
|
else |
138 |
|
out.writeObject(returnval); |
139 |
|
|
140 |
out.flush(); |
out.flush(); |
141 |
} |
} |