| Method from org.apache.bsf.debug.util.Stub Detail: |
public static void Init(SocketConnection con) {
UNDEFINED =
new Stub(con, DebugConstants.SPECIAL_TID, DebugConstants.UNDEFINED_UID);
NOT_FOUND =
new Stub(con, DebugConstants.SPECIAL_TID, DebugConstants.NOT_FOUND_UID);
}
|
public void addListener(RemoteServiceListener l) {
if (m_listeners == null)
m_listeners = new Vector();
m_listeners.addElement(l);
}
|
public void completeFuture(Object requester) throws RemoteException {
Enumeration e;
FutureCell cell = null;
DebugLog.stdoutPrintln(
"Completing future for requester " + requester + " on " + this,
DebugLog.BSF_LOG_L3);
try {
synchronized (m_futureLock) {
cell = findFuture(requester);
DebugLog.stdoutPrintln(
"Waking up future for requester " + requester + " on " + this,
DebugLog.BSF_LOG_L3);
// OG m_futureCells.removeElement(cell);
cell.resume = true;
m_futureLock.notifyAll();
}
} catch (Exception ex) {
throw new RemoteException("Error in future management", ex);
}
}
|
public void createFuture(Object requester) throws RemoteException {
Enumeration e;
FutureCell cell;
DebugLog.stdoutPrintln(
"Creating future for requester " + requester + " on " + this,
DebugLog.BSF_LOG_L3);
try {
synchronized (m_futureLock) {
e = m_futureCells.elements();
while (e.hasMoreElements()) {
cell = (FutureCell) e.nextElement();
if (cell.requester == requester)
throw new Exception("Can't create multiple future on same requester.");
}
cell = new FutureCell();
cell.requester = requester;
cell.thread = Thread.currentThread();
cell.resume = false;
m_futureCells.addElement(cell);
}
} catch (Exception ex) {
throw new RemoteException("Error in future management", ex);
}
}
|
public boolean equals(Object o) {
if (o instanceof Stub)
return m_uid == ((Stub) o).m_uid;
return false;
}
|
public SocketConnection getConnection() {
return m_con;
}
|
public int getTid() {
return m_tid;
}
|
public int getUid() {
return m_uid;
}
|
public void removeListener(RemoteServiceListener l) {
if (m_listeners != null) {
m_listeners.removeElement(l);
}
}
|
public void revokeFuture(Object requester,
Exception ex) throws Exception {
Enumeration e;
FutureCell cell = null;
DebugLog.stdoutPrintln(
"revoking future for requester " + requester + " on " + this,
DebugLog.BSF_LOG_L3);
try {
synchronized (m_futureLock) {
cell = findFuture(requester);
DebugLog.stdoutPrintln(
"Waking up future for requester " + requester + " on " + this,
DebugLog.BSF_LOG_L3);
// OG m_futureCells.removeElement(cell);
cell.resume = true;
cell.ex = ex;
m_futureLock.notifyAll();
}
} catch (Exception ex2) {
throw new RemoteException("Error in future management", ex2);
}
}
|
public void revoked() {
Enumeration e;
RemoteServiceListener l;
DebugLog.stdoutPrintln("Revoking a stub " + this, DebugLog.BSF_LOG_L3);
m_revoked = true;
if (m_listeners == null)
return;
e = m_listeners.elements();
while (e.hasMoreElements()) {
l = (RemoteServiceListener) e.nextElement();
l.revokedNotify(this);
}
FutureCell cell = null;
Exception ex = new RemoteException("Lost connection... stub revoked");
DebugLog.stdoutPrintln(" revoking futures...", DebugLog.BSF_LOG_L3);
synchronized (m_futureLock) {
e = m_futureCells.elements();
while (e.hasMoreElements()) {
cell = (FutureCell) e.nextElement();
DebugLog.stdoutPrintln(
" revoking for requester " + cell.requester,
DebugLog.BSF_LOG_L3);
cell.resume = true;
cell.ex = ex;
m_futureLock.notifyAll();
}
DebugLog.stdoutPrintln(" Done with futures.", DebugLog.BSF_LOG_L3);
m_futureCells = new Vector();
}
}
|
public void suspendFuture(Object requester) throws RemoteException {
Enumeration e;
FutureCell cell = null;
DebugLog.stdoutPrintln(
"Suspending on future for requester " + requester + " on " + this,
DebugLog.BSF_LOG_L3);
try {
synchronized (m_futureLock) {
cell = findFuture(requester);
DebugLog.stdoutPrintln(
"Suspending future for "
+ cell.requester
+ " on thread "
+ cell.thread
+ " on "
+ this,
DebugLog.BSF_LOG_L3);
if (!cell.resume & !this.m_revoked) {
// only do the loop if we need to suspend
// it may be the case that the debugger called back
// a "run" or "step" command as part of the callback,
// before it returned.
while (true) {
try {
m_futureLock.wait(1000);
if (cell.resume)
break;
if (this.m_revoked)
break;
} catch (InterruptedException ex) {
}
}
}
// remove the future...
m_futureCells.removeElement(cell);
// Treat the future state and act accordingly.
if (cell.ex != null) {
DebugLog.stdoutPrintln(
"Future for "
+ cell.requester
+ " on thread "
+ cell.thread
+ " throwing Exception "
+ cell.ex,
DebugLog.BSF_LOG_L3);
throw cell.ex;
} else {
DebugLog.stdoutPrintln(
"Future for " + cell.requester + " on thread " + cell.thread + " resuming...",
DebugLog.BSF_LOG_L3);
}
}
} catch (Exception ex) {
throw new RemoteException("Error in future management", ex);
}
}
|
public Stub swizzle(int tid,
int uid) {
return m_con.swizzle(tid, uid);
}
|