c.writeAndFlush(response.build()); if (statsEnabled) { bkStats.getOpStats(BKStats.STATS_UNKNOWN).incrementFailedOps(); c.writeAndFlush(ResponseBuilder.buildErrorResponse(BookieProtocol.EBADREQ, r)); if (statsEnabled) { bkStats.getOpStats(BKStats.STATS_UNKNOWN).incrementFailedOps();
/** * Diff with base opstats. * * @param base * base opstats * @return diff opstats */ public OpStats diff(OpStats base) { OpStats diff = new OpStats(); diff.maxLatency = this.maxLatency > base.maxLatency ? this.maxLatency : base.maxLatency; diff.minLatency = this.minLatency > base.minLatency ? base.minLatency : this.minLatency; diff.totalLatency = this.totalLatency - base.totalLatency; diff.numSuccessOps = this.numSuccessOps - base.numSuccessOps; diff.numFailedOps = this.numFailedOps - base.numFailedOps; for (int i = 0; i < NUM_BUCKETS; i++) { diff.latencyBuckets[i] = this.latencyBuckets[i] - base.latencyBuckets[i]; } return diff; }
@Override public void operationComplete(Future<Channel> future) throws Exception { // notify the AuthPlugin the completion of the handshake, even in case of failure AuthHandler.ServerSideHandler authHandler = c.pipeline() .get(AuthHandler.ServerSideHandler.class); authHandler.authProvider.onProtocolUpgrade(); if (future.isSuccess()) { LOG.info("Session is protected by: {}", sslHandler.engine().getSession().getCipherSuite()); } else { LOG.error("TLS Handshake failure: {}", future.cause()); BookkeeperProtocol.Response.Builder errResponse = BookkeeperProtocol.Response.newBuilder() .setHeader(r.getHeader()).setStatus(BookkeeperProtocol.StatusCode.EIO); c.writeAndFlush(errResponse.build()); if (statsEnabled) { bkStats.getOpStats(BKStats.STATS_UNKNOWN).incrementFailedOps(); } } } });
/** * Diff with base stats. * * @param base base stats * @return diff stats */ public BKStats diff(BKStats base) { BKStats diff = new BKStats(); for (int i = 0; i < NUM_STATS; i++) { diff.setOpStats(i, stats[i].diff(base.getOpStats(i))); } return diff; }
/** * Copy stats from other stats. * * @param other other stats */ public void copyOf(BKStats other) { for (int i = 0; i < NUM_STATS; i++) { stats[i].copyOf(other.getOpStats(i)); } } }
private BKStats() { for (int i = 0; i < NUM_STATS; i++) { stats[i] = new OpStats(); } }