home *** CD-ROM | disk | FTP | other *** search
- package sun.rmi.transport;
-
- import java.io.DataOutputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.PrintStream;
- import java.rmi.RemoteException;
- import java.rmi.server.LogStream;
- import java.rmi.server.UID;
- import java.util.Enumeration;
- import java.util.Vector;
- import sun.rmi.server.MarshalInputStream;
-
- class ConnectionInputStream extends MarshalInputStream {
- private boolean ack = false;
- private Vector objList;
- private UID ackID = new UID();
-
- ConnectionInputStream(InputStream var1) throws IOException {
- super(var1);
- }
-
- void readID() throws IOException {
- this.ackID = UID.read(this);
- }
-
- void saveRef(LiveRef var1) {
- if (this.objList == null) {
- this.objList = new Vector();
- }
-
- this.objList.addElement(var1);
- }
-
- void registerRefs() throws IOException {
- try {
- if (this.objList != null) {
- Enumeration var3 = this.objList.elements();
-
- while(var3.hasMoreElements()) {
- LiveRef var9 = (LiveRef)var3.nextElement();
- DGCClient.referenced(var9);
- }
- }
- } catch (RemoteException var7) {
- if (DGCImpl.logLevel >= 10) {
- LogStream var4 = LogStream.log("dgc");
- ((PrintStream)var4).println("ConnectionInputStream.registerRefs: exception: ");
- ((Throwable)var7).printStackTrace(var4);
- }
-
- throw var7;
- } finally {
- this.objList = null;
- }
-
- }
-
- void setAckNeeded() {
- this.ack = true;
- }
-
- void done(Connection var1) {
- if (this.ack) {
- Connection var2 = null;
- Channel var3 = null;
- boolean var4 = true;
- if (DGCImpl.logLevel >= 20) {
- LogStream.log("dgc").println("ConnectionInputStream.done: send ack");
- }
-
- try {
- var3 = var1.getChannel();
- var2 = var3.newConnection();
- DataOutputStream var5 = new DataOutputStream(var2.getOutputStream());
- var5.writeByte(84);
- this.ackID.write(var5);
- var2.releaseOutputStream();
- } catch (RemoteException var7) {
- var4 = false;
- } catch (IOException var8) {
- var4 = false;
- }
-
- try {
- if (var2 != null) {
- var3.free(var2, var4);
- return;
- }
- } catch (RemoteException var6) {
- return;
- }
- }
-
- }
- }
-