1 55 56 package org.apache.bsf.debug.util; 57 58 import java.util.*; 59 import org.apache.bsf.debug.jsdi.*; 60 import org.apache.bsf.debug.util.*; 61 62 85 public abstract class StubTable { 86 87 protected IntHashtable m_stubs; 88 protected SocketConnection m_con; 89 90 public StubTable(SocketConnection con) { 91 m_con = con; 92 m_stubs = new IntHashtable(); 93 } 94 95 public void disconnectNotify() { 97 Enumeration e; 98 Stub s; 99 DebugLog.stdoutPrintln("Revoking stubs...", 100 DebugLog.BSF_LOG_L3); 101 102 e = m_stubs.elements(); 103 while (e.hasMoreElements()) { 104 s = (Stub)e.nextElement(); 105 s.revoked(); 106 } 107 m_stubs = new IntHashtable(); 108 } 109 110 protected abstract Stub factory(int tid, int uid); 112 113 public synchronized Stub swizzle(int tid, int uid) { 115 Stub Stub=null; 116 117 if (uid== DebugConstants.NOT_FOUND_UID) 118 return Stub.NOT_FOUND; 119 if (uid== DebugConstants.UNDEFINED_UID) 120 return Stub.UNDEFINED; 121 122 Stub = (Stub)m_stubs.get(uid); 123 if (Stub==null) { 124 Stub = factory(tid,uid); 125 m_stubs.put(uid,Stub); 126 } 127 return Stub; 128 } 129 } 130 131 | Popular Tags |