⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transportbindingmetric.java

📁 JXTA&#8482 is a set of open, generalized peer-to-peer (P2P) protocols that allow any networked devi
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    }    public int getConnections() {        return acceptorConnections + initiatorConnections;    }    public int getConnectionsClosed() {        return acceptorConnectionsClosed + initiatorConnectionsClosed;    }    public int getConnectionsDropped() {        return acceptorConnectionsDropped + initiatorConnectionsDropped;    }    public int getConnectionsFailed() {        return acceptorConnectionsFailed + initiatorConnectionsFailed;    }    public int getMessagesReceived() {        return acceptorMessagesReceived + initiatorMessagesReceived;    }    public int getMessagesSent() {        return acceptorMessagesSent + initiatorMessagesSent;    }    public long getReceiveFailureProcessingTime() {        return acceptorReceiveFailureProcessingTime + initiatorReceiveFailureProcessingTime;    }    public int getReceiveFailures() {        return acceptorReceiveFailures + initiatorReceiveFailures;    }    public long getReceiveProcessingTime() {        return acceptorReceiveProcessingTime + initiatorReceiveProcessingTime;    }    public long getSendFailureProcessingTime() {        return acceptorSendFailureProcessingTime + initiatorSendFailureProcessingTime;    }    public int getSendFailures() {        return acceptorSendFailures + initiatorSendFailures;    }    public long getSendProcessingTime() {        return acceptorSendProcessingTime + initiatorSendProcessingTime;    }    public long getTotalTimeConnected() {        return acceptorTotalTimeConnected + initiatorTotalTimeConnected;    }    public long getTimeToConnect() {        return acceptorTimeToConnect + initiatorTimeToConnect;    }    public long getTimeToFail() {        return acceptorTimeToFail + initiatorTimeToFail;    }    public int getAveragePingTime() {        return (int) ((numPings != 0) ? (pingTime / numPings) : 0);    }    public int getAveragePingFailedTime() {        return (int) ((numFailedPings != 0) ? (pingFailedTime / numFailedPings) : 0);    }    public int getAverageAcceptorReceiveFailureProcessingTime() {        return (int) ((acceptorReceiveFailures != 0) ? (acceptorReceiveFailureProcessingTime / acceptorReceiveFailures) : 0);    }    public int getAverageAcceptorReceiveProcessingTime() {        return (int) ((acceptorMessagesReceived != 0) ? (acceptorReceiveProcessingTime / acceptorMessagesReceived) : 0);    }    public int getAverageAcceptorSendFailureProcessingTime() {        return (int) ((acceptorSendFailures != 0) ? (acceptorSendFailureProcessingTime / acceptorSendFailures) : 0);    }    public int getAverageAcceptorSendProcessingTime() {        return (int) ((acceptorMessagesSent != 0) ? (acceptorSendProcessingTime / acceptorMessagesSent) : 0);    }    public int getAverageAcceptorTimeToConnect() {        return (int) ((acceptorConnections != 0) ? (acceptorTimeToConnect / acceptorConnections) : 0);    }    public int getAverageAcceptorTimeToFail() {        return (int) ((acceptorConnectionsFailed != 0) ? (acceptorTimeToFail / acceptorConnectionsFailed) : 0);    }    public int getAverageInitiatorReceiveFailureProcessingTime() {        return (int) ((initiatorReceiveFailures != 0) ? (initiatorReceiveFailureProcessingTime / initiatorReceiveFailures) : 0);    }    public int getAverageInitiatorReceiveProcessingTime() {        return (int) ((initiatorMessagesReceived != 0) ? (initiatorReceiveProcessingTime / initiatorMessagesReceived) : 0);    }    public int getAverageInitiatorSendFailureProcessingTime() {        return (int) ((initiatorSendFailures != 0) ? (initiatorSendFailureProcessingTime / initiatorSendFailures) : 0);    }    public int getAverageInitiatorSendProcessingTime() {        return (int) ((initiatorMessagesSent != 0) ? (initiatorSendProcessingTime / initiatorMessagesSent) : 0);    }    public int getAverageInitiatorTimeToConnect() {        return (int) ((initiatorConnections != 0) ? (initiatorTimeToConnect / initiatorConnections) : 0);    }    public int getAverageInitiatorTimeToFail() {        return (int) ((initiatorConnectionsFailed != 0) ? (initiatorTimeToFail / initiatorConnectionsFailed) : 0);    }    public int getAverageReceiveFailureProcessingTime() {        return (int) (((initiatorReceiveFailures + acceptorReceiveFailures) != 0)                ? ((initiatorReceiveFailureProcessingTime + acceptorReceiveFailureProcessingTime)                        / (initiatorReceiveFailures + acceptorReceiveFailures))                        : 0);    }    public int getAverageReceiveProcessingTime() {        return (int) (((initiatorMessagesReceived + acceptorMessagesReceived) != 0)                ? ((initiatorReceiveProcessingTime + acceptorReceiveProcessingTime)                        / (initiatorMessagesReceived + acceptorMessagesReceived))                        : 0);    }    public int getAverageSendFailureProcessingTime() {        return (int) (((initiatorSendFailures + acceptorSendFailures) != 0)                ? ((initiatorSendFailureProcessingTime + acceptorSendFailureProcessingTime)                        / (initiatorSendFailures + acceptorSendFailures))                        : 0);    }    public int getAverageSendProcessingTime() {        return (int) (((initiatorMessagesSent + acceptorMessagesSent) != 0)                ? ((initiatorSendProcessingTime + acceptorSendProcessingTime) / (initiatorMessagesSent + acceptorMessagesSent))                : 0);    }    public int getAverageTimeToConnect() {        return (int) (((initiatorConnections + acceptorConnections) != 0)                ? ((initiatorTimeToConnect + acceptorTimeToConnect) / (initiatorConnections + acceptorConnections))                : 0);    }    public int getAverageTimeToFail() {        return (int) (((initiatorConnectionsFailed + acceptorConnectionsFailed) != 0)                ? ((initiatorTimeToFail + acceptorTimeToFail) / (initiatorConnectionsFailed + acceptorConnectionsFailed))                : 0);    }    /**     * Get the total time this intiated connection has been connected.     * <BR><BR>     * <B>Note:</B> This does not include the current time connected (if it is currently connected)     *     * @return time in ms (see note above)     * @see #getTotalTimeConnected()     */    public long getInitiatorTotalTimeConnected() {        return initiatorTotalTimeConnected;    }    /**     * Get the total time this initiating connection has been connected.  If it is currently     * connected, then the total time is adjusted to include the time since the transition time     * to become connected until the provided time     *     * @param adjustmentTime The time of this metric will be adjusted to     * @return time in ms (see note above)     * @see #getTotalTimeConnected()     */    public long getInitiatorTotalTimeConnected(long adjustmentTime) {        long result = initiatorTotalTimeConnected;        if (isInitiatorConnected()) {            result += (adjustmentTime - this.initiatorTransitionTime);        }        return result;    }    /**     * Get the duration of current connection relative to local clock (from transition time)     * <BR><BR>     * <B>Note:</B> This assumes the clocks are in sync with the reporting peer     *     * @return time in ms (see note above) or 0 if not connected     * @see #getTotalTimeConnected()     */    public long getInitiatorTimeConnected() {        return getInitiatorTimeConnected(System.currentTimeMillis());    }    /**     * Get the duration of current connection until the specified time     *     * @param adjustmentTime The time of this metric will be computed until     * @return time in ms (see note above) or 0 if not connected     */    public long getInitiatorTimeConnected(long adjustmentTime) {        if (isInitiatorConnected()) {            return (adjustmentTime - this.initiatorTransitionTime);        } else {            return 0;        }    }    /**     * Get the total time this intiated connection has been connected.     * <BR><BR>     * <B>Note:</B> This does not include the current time connected (if it is currently connected)     *     * @return time in ms (see note above)     * @see #getTotalTimeConnected()     */    public long getAcceptorTotalTimeConnected() {        return acceptorTotalTimeConnected;    }    /**     * Get the total time this initiating connection has been connected.  If it is currently     * connected, then the total time is adjusted to include the time since the transition time     * to become connected until the provided time     *     * @param adjustmentTime The time of this metric will be adjusted to     * @return time in ms (see note above)     * @see #getTotalTimeConnected()     */    public long getAcceptorTotalTimeConnected(long adjustmentTime) {        long result = acceptorTotalTimeConnected;        if (isAcceptorConnected()) {            result += (adjustmentTime - this.acceptorTransitionTime);        }        return result;    }    /**     * Get the duration of current connection relative to local clock (from transition time)     * <BR><BR>     * <B>Note:</B> This assumes the clocks are in sync with the reporting peer     *     * @return time in ms (see note above) or 0 if not connected     * @see #getTotalTimeConnected()     */    public long getAcceptorTimeConnected() {        return getAcceptorTimeConnected(System.currentTimeMillis());    }    /**     * Get the duration of current connection until the specified time     *     * @param adjustmentTime The time of this metric will be computed until     * @return time in ms (see note above) or 0 if not connected     */    public long getAcceptorTimeConnected(long adjustmentTime) {        if (isAcceptorConnected()) {            return (adjustmentTime - this.acceptorTransitionTime);        } else {            return 0;        }    }    void resetInitiatorState(String state, long transitionTime) {        if (isInitiatorConnected()) {            acceptorTotalTimeConnected += (System.currentTimeMillis() - this.initiatorTransitionTime);        }        this.initiatorState = state;        this.initiatorTransitionTime = transitionTime;        // System.out.println("initiatorState: " + initiatorState + " " + endpointAddress);    }    void resetAcceptorState(String state, long transitionTime) {        if (isAcceptorConnected()) {            initiatorTotalTimeConnected += (System.currentTimeMillis() - this.acceptorTransitionTime);        }        this.acceptorState = state;        this.acceptorTransitionTime = transitionTime;        // System.out.println("acceptorState: " + acceptorState + " " + endpointAddress);    }    void connectionEstablished(boolean initiator, long timeToConnect, long transitionTime) {        if (initiator) {            resetInitiatorState(CONNECTED, transitionTime);            initiatorConnections++;            initiatorTimeToConnect += timeToConnect;        } else {            resetAcceptorState(CONNECTED, transitionTime);            acceptorConnections++;            acceptorTimeToConnect += timeToConnect;        }    }    void connectionFailed(boolean initiator, long timeToConnect, long transitionTime) {        if (initiator) {            resetInitiatorState(FAILED, transitionTime);            initiatorConnectionsFailed++;            initiatorTimeToFail += timeToConnect;        } else {            resetAcceptorState(FAILED, transitionTime);            acceptorConnectionsFailed++;            acceptorTimeToFail += timeToConnect;        }    }    void connectionClosed(boolean initiator, long transitionTime) {        if (initiator) {            resetInitiatorState(CLOSED, transitionTime);            initiatorConnectionsClosed++;        } else {            resetAcceptorState(CLOSED, transitionTime);            acceptorConnectionsClosed++;        }    }    void connectionDropped(boolean initiator, long transitionTime) {        if (initiator) {            resetInitiatorState(DROPPED, transitionTime);            initiatorConnectionsDropped++;        } else {            resetAcceptorState(DROPPED, transitionTime);            acceptorConnectionsDropped++;        }    }    void pingReceived() {        numPingsReceived++;    }    void ping(long time) {        numPings++;        pingTime += time;    }    void pingFailed(long time) {        numFailedPings++;        pingFailedTime += time;    }    void dataReceived(boolean initiator, int size) {        if (initiator) {            initiatorBytesReceived += size;        } else {            acceptorBytesReceived += size;        }    }    void messageReceived(boolean initiator, Message message, long time, long size) {        if (initiator) {            initiatorMessagesReceived++;            initiatorReceiveProcessingTime += time;            initiatorBytesReceived += size;        } else {            acceptorMessagesReceived++;            acceptorReceiveProcessingTime += time;            acceptorBytesReceived += size;        }    }    void receiveFailure(boolean initiator, long time, long size) {        if (initiator) {            initiatorReceiveFailures++;            initiatorReceiveFailureProcessingTime += time;            initiatorBytesReceived += size;        } else {            acceptorReceiveFailures++;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -