From 66afe965280373142e64fe969c434740a92a373e Mon Sep 17 00:00:00 2001 From: huazhongming Date: Wed, 16 Jan 2019 10:05:52 +0800 Subject: [PATCH] Modified to lower camel case (#3003) --- .../dubbo/common/compiler/support/ClassUtils.java | 8 ++++---- .../threadpool/support/AbortPolicyWithReport.java | 4 ++-- .../qos/server/handler/HttpProcessHandler.java | 14 +++++++------- .../dubbo/rpc/protocol/dubbo/DubboProtocol.java | 6 +++--- .../protocol/dubbo/telnet/LogTelnetHandler.java | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java index 1c552086016..133ece552ba 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java @@ -56,12 +56,12 @@ public static Object newInstance(String name) { public static Class forName(String[] packages, String className) { try { - return _forName(className); + return classForName(className); } catch (ClassNotFoundException e) { if (packages != null && packages.length > 0) { for (String pkg : packages) { try { - return _forName(pkg + "." + className); + return classForName(pkg + "." + className); } catch (ClassNotFoundException e2) { } } @@ -72,13 +72,13 @@ public static Class forName(String[] packages, String className) { public static Class forName(String className) { try { - return _forName(className); + return classForName(className); } catch (ClassNotFoundException e) { throw new IllegalStateException(e.getMessage(), e); } } - public static Class _forName(String className) throws ClassNotFoundException { + public static Class classForName(String className) throws ClassNotFoundException { switch (className) { case "boolean": return boolean.class; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReport.java b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReport.java index 7aef31ca94f..0f4f72a7d69 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReport.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReport.java @@ -85,10 +85,10 @@ public void run() { SimpleDateFormat sdf; - String OS = System.getProperty("os.name").toLowerCase(); + String os = System.getProperty("os.name").toLowerCase(); // window system don't support ":" in file name - if(OS.contains("win")){ + if(os.contains("win")){ sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); }else { sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/HttpProcessHandler.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/HttpProcessHandler.java index 9a36c9758c0..408e1857c96 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/HttpProcessHandler.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/HttpProcessHandler.java @@ -58,27 +58,27 @@ protected void channelRead0(ChannelHandlerContext ctx, HttpRequest msg) throws E // return 404 when fail to construct command context if (commandContext == null) { log.warn("can not found commandContext url: " + msg.getUri()); - FullHttpResponse response = http_404(); + FullHttpResponse response = http404(); ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } else { commandContext.setRemote(ctx.channel()); try { String result = commandExecutor.execute(commandContext); - FullHttpResponse response = http_200(result); + FullHttpResponse response = http200(result); ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } catch (NoSuchCommandException ex) { log.error("can not find commandContext: " + commandContext, ex); - FullHttpResponse response = http_404(); + FullHttpResponse response = http404(); ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } catch (Exception qosEx) { log.error("execute commandContext: " + commandContext + " got exception", qosEx); - FullHttpResponse response = http_500(qosEx.getMessage()); + FullHttpResponse response = http500(qosEx.getMessage()); ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } } } - private static final FullHttpResponse http_200(String result) { + private static final FullHttpResponse http200(String result) { FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(result.getBytes())); HttpHeaders httpHeaders = response.headers(); @@ -87,7 +87,7 @@ private static final FullHttpResponse http_200(String result) { return response; } - private static final FullHttpResponse http_404() { + private static final FullHttpResponse http404() { FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.NOT_FOUND); HttpHeaders httpHeaders = response.headers(); httpHeaders.set(HttpHeaders.Names.CONTENT_TYPE, "text/plain"); @@ -95,7 +95,7 @@ private static final FullHttpResponse http_404() { return response; } - private static final FullHttpResponse http_500(String errorMessage) { + private static final FullHttpResponse http500(String errorMessage) { FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.INTERNAL_SERVER_ERROR , Unpooled.wrappedBuffer(errorMessage.getBytes())); HttpHeaders httpHeaders = response.headers(); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java index d3ac2201012..7a0be74dcc1 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java @@ -364,17 +364,17 @@ public Invoker refer(Class serviceType, URL url) throws RpcException { private ExchangeClient[] getClients(URL url) { // whether to share connection - boolean service_share_connect = false; + boolean serviceShareConnect = false; int connections = url.getParameter(Constants.CONNECTIONS_KEY, 0); // if not configured, connection is shared, otherwise, one connection for one service if (connections == 0) { - service_share_connect = true; + serviceShareConnect = true; connections = 1; } ExchangeClient[] clients = new ExchangeClient[connections]; for (int i = 0; i < clients.length; i++) { - if (service_share_connect) { + if (serviceShareConnect) { clients[i] = getSharedClient(url); } else { clients[i] = initClient(url); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/LogTelnetHandler.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/LogTelnetHandler.java index ac2379784c1..5ab3c27a6fb 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/LogTelnetHandler.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/LogTelnetHandler.java @@ -52,7 +52,7 @@ public String telnet(Channel channel, String message) { if (!StringUtils.isInteger(str[0])) { LoggerFactory.setLevel(Level.valueOf(message.toUpperCase())); } else { - int SHOW_LOG_LENGTH = Integer.parseInt(str[0]); + int showLogLength = Integer.parseInt(str[0]); if (file != null && file.exists()) { try { @@ -60,12 +60,12 @@ public String telnet(Channel channel, String message) { FileChannel filechannel = fis.getChannel(); size = filechannel.size(); ByteBuffer bb; - if (size <= SHOW_LOG_LENGTH) { + if (size <= showLogLength) { bb = ByteBuffer.allocate((int) size); filechannel.read(bb, 0); } else { - int pos = (int) (size - SHOW_LOG_LENGTH); - bb = ByteBuffer.allocate(SHOW_LOG_LENGTH); + int pos = (int) (size - showLogLength); + bb = ByteBuffer.allocate(showLogLength); filechannel.read(bb, pos); } bb.flip();