ibm java 계열에서 RMI/IIOP를 사용할때 자주 보는 메서드 중 하나가 com.ibm.rmi.iiop.OutCallDesc.waitForResponse() 이다.
com.ibm.rmi.iiop.OutCallDesc.waitForResponse() 메소드는 IIOP(Interoperable Object Reference Protocol) 프로토콜을 사용하여 원격 객체(서버)와 통신하고 결과를 기다리는 메소드이다.
이 메소드는 IIOP 프로토콜을 사용하여 원격 객체에 요청을 보내고, 요청에 대한 응답을 기다리는데 사용된다. 이 메소드는 동기적인 호출을 수행하므로, 호출자는 응답이 올 때까지 대기하게 된다.
waitForResponse() 메소드는 다음과 같은 작업을 수행한다.
요청 메시지를 IIOP 프로토콜을 사용하여 원격 객체에 전송한다.
응답이 올 때까지 대기한다.
응답이 수신되면 응답 메시지를 처리하고 결과를 반환한다.
waitForResponse() 메소드는 IIOP 프로토콜을 사용하여 원격 객체와 통신하는 기능을 수행하는 중요한 메소드 중 하나이다. 이 메소드는 RMI(Java Remote Method Invocation) 프레임워크에서 사용되는 핵심 메소드 중 하나이며, 원격 객체와의 통신을 위해 필수적으로 사용된다.
package com.ibm.rmi.iiop;
import org.omg.CORBA.SystemException;
public final class OutCallDesc {
private SystemException responseException = null;
private IIOPReader responseStream = null;
private boolean responseSet = false;
public synchronized void waitForResponse(long var1) throws InterruptedException {
if (!this.responseSet) {
this.wait(var1);
}
}
public synchronized void setResponse(IIOPReader var1) {
if (!this.responseSet) {
this.responseStream = var1;
this.responseSet = true;
this.notify();
}
}
public synchronized void setResponse(SystemException var1) {
if (!this.responseSet) {
this.responseException = var1;
this.responseSet = true;
this.notify();
}
}
public synchronized Object getResponse() {
return null == this.responseStream ? this.responseException : this.responseStream;
}
public synchronized SystemException getResponseException() {
return this.responseException;
}
public synchronized boolean isResponseSet() {
return this.responseSet;
}
}