微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.apache.catalina.tribes.transport.Constants的实例源码

项目:tomcat7    文件BioSender.java   
/**
 * Wait for AckNowledgement from other server.
 * FIXME Please,not wait only for three characters,better control that the wait ack message is correct.
 * @throws java.io.IOException
 * @throws java.net.socketTimeoutException
 */
protected void waitForAck() throws java.io.IOException {
    try {
        boolean ackReceived = false;
        boolean failAckReceived = false;
        ackbuf.clear();
        int bytesRead = 0;
        int i = soIn.read();
        while ((i != -1) && (bytesRead < Constants.ACK_COMMAND.length)) {
            bytesRead++;
            byte d = (byte)i;
            ackbuf.append(d);
            if (ackbuf.doesPackageExist() ) {
                byte[] ackcmd = ackbuf.extractDataPackage(true).getBytes();
                ackReceived = Arrays.equals(ackcmd,org.apache.catalina.tribes.transport.Constants.ACK_DATA);
                failAckReceived = Arrays.equals(ackcmd,org.apache.catalina.tribes.transport.Constants.FAIL_ACK_DATA);
                ackReceived = ackReceived || failAckReceived;
                break;
            }
            i = soIn.read();
        }
        if (!ackReceived) {
            if (i == -1) throw new IOException(sm.getString("IDataSender.ack.eof",getAddress(),Integer.valueOf(socket.getLocalPort())));
            else throw new IOException(sm.getString("IDataSender.ack.wrong",Integer.valueOf(socket.getLocalPort())));
        } else if ( failAckReceived && getThrowOnFailedAck()) {
            throw new RemoteProcessException("Received a Failed ack:org.apache.catalina.tribes.transport.Constants.FAIL_ACK_DATA");
        }
    } catch (IOException x) {
        String errmsg = sm.getString("IDataSender.ack.missing",Integer.valueOf(socket.getLocalPort()),Long.valueOf(getTimeout()));
        if ( SenderState.getSenderState(getDestination()).isReady() ) {
            SenderState.getSenderState(getDestination()).setSUSPECT();
            if ( log.isWarnEnabled() ) log.warn(errmsg,x);
        } else {
            if ( log.isDebugEnabled() )log.debug(errmsg,x);
        }
        throw x;
    } finally {
        ackbuf.clear();
    }
}
项目:tomcat7    文件BioReplicationTask.java   
protected void execute(ObjectReader reader) throws Exception{
    int pkgcnt = reader.count();

    if ( pkgcnt > 0 ) {
        ChannelMessage[] msgs = reader.execute();
        for ( int i=0; i<msgs.length; i++ ) {
            /**
             * Use send ack here if you want to ack the request to the remote 
             * server before completing the request
             * This is considered an asynchronized request
             */
            if (ChannelData.sendAckAsync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            try {
                //process the message
                getCallback().messageDataReceived(msgs[i]);
                /**
                 * Use send ack here if you want the request to complete on this
                 * server before sending the ack to the Remote Server
                 * This is considered a synchronized request
                 */
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            }catch  ( Exception x ) {
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.FAIL_ACK_COMMAND);
                log.error("Error thrown from messageDataReceived.",x);
            }
            if ( getUseBufferPool() ) {
                BufferPool.getBufferPool().returnBuffer(msgs[i].getMessage());
                msgs[i].setMessage(null);
            }
        }                       
    }


}
项目:apache-tomcat-7.0.73-with-comment    文件BioSender.java   
/**
 * Wait for AckNowledgement from other server.
 * FIXME Please,x);
        }
        throw x;
    } finally {
        ackbuf.clear();
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件BioReplicationTask.java   
protected void execute(ObjectReader reader) throws Exception{
    int pkgcnt = reader.count();

    if ( pkgcnt > 0 ) {
        ChannelMessage[] msgs = reader.execute();
        for ( int i=0; i<msgs.length; i++ ) {
            /**
             * Use send ack here if you want to ack the request to the remote 
             * server before completing the request
             * This is considered an asynchronized request
             */
            if (ChannelData.sendAckAsync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            try {
                //process the message
                getCallback().messageDataReceived(msgs[i]);
                /**
                 * Use send ack here if you want the request to complete on this
                 * server before sending the ack to the Remote Server
                 * This is considered a synchronized request
                 */
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            }catch  ( Exception x ) {
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.FAIL_ACK_COMMAND);
                log.error("Error thrown from messageDataReceived.",x);
            }
            if ( getUseBufferPool() ) {
                BufferPool.getBufferPool().returnBuffer(msgs[i].getMessage());
                msgs[i].setMessage(null);
            }
        }                       
    }


}
项目:lazycat    文件BioReplicationTask.java   
protected void execute(ObjectReader reader) throws Exception {
    int pkgcnt = reader.count();

    if (pkgcnt > 0) {
        ChannelMessage[] msgs = reader.execute();
        for (int i = 0; i < msgs.length; i++) {
            /**
             * Use send ack here if you want to ack the request to the
             * Remote Server before completing the request This is
             * considered an asynchronous request
             */
            if (ChannelData.sendAckAsync(msgs[i].getoptions()))
                sendAck(Constants.ACK_COMMAND);
            try {
                // process the message
                getCallback().messageDataReceived(msgs[i]);
                /**
                 * Use send ack here if you want the request to complete on
                 * this server before sending the ack to the Remote Server
                 * This is considered a synchronized request
                 */
                if (ChannelData.sendAckSync(msgs[i].getoptions()))
                    sendAck(Constants.ACK_COMMAND);
            } catch (Exception x) {
                if (ChannelData.sendAckSync(msgs[i].getoptions()))
                    sendAck(Constants.FAIL_ACK_COMMAND);
                log.error("Error thrown from messageDataReceived.",x);
            }
            if (getUseBufferPool()) {
                BufferPool.getBufferPool().returnBuffer(msgs[i].getMessage());
                msgs[i].setMessage(null);
            }
        }
    }

}
项目:class-guard    文件BioSender.java   
/**
 * Wait for AckNowledgement from other server.
 * FIXME Please,new Integer(socket.getLocalPort())));
            else throw new IOException(sm.getString("IDataSender.ack.wrong",new Integer(socket.getLocalPort())));
        } else if ( failAckReceived && getThrowOnFailedAck()) {
            throw new RemoteProcessException("Received a Failed ack:org.apache.catalina.tribes.transport.Constants.FAIL_ACK_DATA");
        }
    } catch (IOException x) {
        String errmsg = sm.getString("IDataSender.ack.missing",new Integer(socket.getLocalPort()),new Long(getTimeout()));
        if ( SenderState.getSenderState(getDestination()).isReady() ) {
            SenderState.getSenderState(getDestination()).setSUSPECT();
            if ( log.isWarnEnabled() ) log.warn(errmsg,x);
        }
        throw x;
    } finally {
        ackbuf.clear();
    }
}
项目:class-guard    文件BioReplicationTask.java   
protected void execute(ObjectReader reader) throws Exception{
    int pkgcnt = reader.count();

    if ( pkgcnt > 0 ) {
        ChannelMessage[] msgs = reader.execute();
        for ( int i=0; i<msgs.length; i++ ) {
            /**
             * Use send ack here if you want to ack the request to the remote 
             * server before completing the request
             * This is considered an asynchronized request
             */
            if (ChannelData.sendAckAsync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            try {
                //process the message
                getCallback().messageDataReceived(msgs[i]);
                /**
                 * Use send ack here if you want the request to complete on this
                 * server before sending the ack to the Remote Server
                 * This is considered a synchronized request
                 */
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            }catch  ( Exception x ) {
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.FAIL_ACK_COMMAND);
                log.error("Error thrown from messageDataReceived.",x);
            }
            if ( getUseBufferPool() ) {
                BufferPool.getBufferPool().returnBuffer(msgs[i].getMessage());
                msgs[i].setMessage(null);
            }
        }                       
    }


}
项目:apache-tomcat-7.0.57    文件BioSender.java   
/**
 * Wait for AckNowledgement from other server.
 * FIXME Please,x);
        }
        throw x;
    } finally {
        ackbuf.clear();
    }
}
项目:apache-tomcat-7.0.57    文件BioReplicationTask.java   
protected void execute(ObjectReader reader) throws Exception{
    int pkgcnt = reader.count();

    if ( pkgcnt > 0 ) {
        ChannelMessage[] msgs = reader.execute();
        for ( int i=0; i<msgs.length; i++ ) {
            /**
             * Use send ack here if you want to ack the request to the remote 
             * server before completing the request
             * This is considered an asynchronized request
             */
            if (ChannelData.sendAckAsync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            try {
                //process the message
                getCallback().messageDataReceived(msgs[i]);
                /**
                 * Use send ack here if you want the request to complete on this
                 * server before sending the ack to the Remote Server
                 * This is considered a synchronized request
                 */
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            }catch  ( Exception x ) {
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.FAIL_ACK_COMMAND);
                log.error("Error thrown from messageDataReceived.",x);
            }
            if ( getUseBufferPool() ) {
                BufferPool.getBufferPool().returnBuffer(msgs[i].getMessage());
                msgs[i].setMessage(null);
            }
        }                       
    }


}
项目:WBSAirback    文件BioSender.java   
/**
 * Wait for AckNowledgement from other server.
 * FIXME Please,x);
        }
        throw x;
    } finally {
        ackbuf.clear();
    }
}
项目:WBSAirback    文件BioReplicationTask.java   
protected void execute(ObjectReader reader) throws Exception{
    int pkgcnt = reader.count();

    if ( pkgcnt > 0 ) {
        ChannelMessage[] msgs = reader.execute();
        for ( int i=0; i<msgs.length; i++ ) {
            /**
             * Use send ack here if you want to ack the request to the remote 
             * server before completing the request
             * This is considered an asynchronized request
             */
            if (ChannelData.sendAckAsync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            try {
                //process the message
                getCallback().messageDataReceived(msgs[i]);
                /**
                 * Use send ack here if you want the request to complete on this
                 * server before sending the ack to the Remote Server
                 * This is considered a synchronized request
                 */
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.ACK_COMMAND);
            }catch  ( Exception x ) {
                if (ChannelData.sendAckSync(msgs[i].getoptions())) sendAck(Constants.FAIL_ACK_COMMAND);
                log.error("Error thrown from messageDataReceived.",x);
            }
            if ( getUseBufferPool() ) {
                BufferPool.getBufferPool().returnBuffer(msgs[i].getMessage());
                msgs[i].setMessage(null);
            }
        }                       
    }


}
项目:lazycat    文件BioSender.java   
/**
 * Wait for AckNowledgement from other server. FIXME Please,not wait only
 * for three characters,better control that the wait ack message is
 * correct.
 * 
 * @throws java.io.IOException
 * @throws java.net.socketTimeoutException
 */
protected void waitForAck() throws java.io.IOException {
    try {
        boolean ackReceived = false;
        boolean failAckReceived = false;
        ackbuf.clear();
        int bytesRead = 0;
        int i = soIn.read();
        while ((i != -1) && (bytesRead < Constants.ACK_COMMAND.length)) {
            bytesRead++;
            byte d = (byte) i;
            ackbuf.append(d);
            if (ackbuf.doesPackageExist()) {
                byte[] ackcmd = ackbuf.extractDataPackage(true).getBytes();
                ackReceived = Arrays.equals(ackcmd,org.apache.catalina.tribes.transport.Constants.FAIL_ACK_DATA);
                ackReceived = ackReceived || failAckReceived;
                break;
            }
            i = soIn.read();
        }
        if (!ackReceived) {
            if (i == -1)
                throw new IOException(
                        sm.getString("IDataSender.ack.eof",Integer.valueOf(socket.getLocalPort())));
            else
                throw new IOException(sm.getString("IDataSender.ack.wrong",Integer.valueOf(socket.getLocalPort())));
        } else if (failAckReceived && getThrowOnFailedAck()) {
            throw new RemoteProcessException(
                    "Received a Failed ack:org.apache.catalina.tribes.transport.Constants.FAIL_ACK_DATA");
        }
    } catch (IOException x) {
        String errmsg = sm.getString("IDataSender.ack.missing",Long.valueOf(getTimeout()));
        if (SenderState.getSenderState(getDestination()).isReady()) {
            SenderState.getSenderState(getDestination()).setSUSPECT();
            if (log.isWarnEnabled())
                log.warn(errmsg,x);
        } else {
            if (log.isDebugEnabled())
                log.debug(errmsg,x);
        }
        throw x;
    } finally {
        ackbuf.clear();
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。