public Object after(Invocation inv, Object instruction) {
// codes for fix this exception: "Cannot forward after response has been committed"
// @see RoseFilter#supportsRosepipe
// @see PortalImpl#addWindow
Pipe pipe = PortalUtils.getPipe(inv);
if (pipe != null && pipe.getInvocation() == inv) {
boolean debugEnabled = logger.isDebugEnabled();
if (debugEnabled) {
logger.debug(pipe + " is going to wait pipe windows' ins.");
}
final long begin = System.currentTimeMillis();
final long deadline;
if (pipe.getTimeout() > 0) {
deadline = begin + pipe.getTimeout();
} else {
deadline = -1;
}
try {
for (Window window : pipe.getWindows()) {
if (window.get(RoseConstants.PIPE_WINDOW_IN) != Boolean.TRUE) {
synchronized (window) {
while (window.get(RoseConstants.PIPE_WINDOW_IN) != Boolean.TRUE) {
long now = System.currentTimeMillis();
if (deadline <= 0) {