From 77bd66cf509fff53e2f9307e5e5247cb91e5c107 Mon Sep 17 00:00:00 2001 From: Kirill Liubun Date: Fri, 30 Sep 2016 16:40:24 +0300 Subject: [PATCH] Fix code style --- .../server/common/dao/CredentialsService.java | 21 ++++++---- .../server/common/dao/EndpointService.java | 23 +++++++---- .../server/sync/platform/package-info.java | 3 +- .../kaa/server/thrift/NeighborConnection.java | 3 +- .../kaa/server/thrift/NeighborTemplate.java | 2 +- .../kaa/server/thrift/Neighbors.java | 41 ++++++++++--------- .../service/DefaultControlService.java | 6 +-- .../exception/ControlServiceException.java | 4 +- .../control/service/sdk/SdkGenerator.java | 25 +++++------ .../CredentialsServiceAdapter.java | 10 +++-- .../DefaultCredentialsServiceLocator.java | 13 ++++-- .../cluster/DefaultClusterService.java | 8 ++-- .../service/event/DefaultEventService.java | 10 ++--- 13 files changed, 95 insertions(+), 74 deletions(-) diff --git a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/CredentialsService.java b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/CredentialsService.java index fe2c3e0a3f..9fcf00e920 100644 --- a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/CredentialsService.java +++ b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/CredentialsService.java @@ -25,11 +25,11 @@ /** * A service to manage security credentials. * - * In general, each application has its own independent credentials service used + *

In general, each application has its own independent credentials service used * as a bridge to some external system. Since Kaa acts as such a system by * default, a single credentials service is enough to be used across all * applications. Its methods require an additonal parameter, though, namely the - * application ID. + * application ID.

* * @author Andrew Shvayka * @author Bohdan Khablenko @@ -45,7 +45,8 @@ public interface CredentialsService { * @return The credentials provided * @throws CredentialsServiceException - if an unexpected exception occures. */ - CredentialsDto provideCredentials(String applicationId, CredentialsDto credentials) throws CredentialsServiceException; + CredentialsDto provideCredentials(String applicationId, CredentialsDto credentials) + throws CredentialsServiceException; /** * Returns the credentials by ID. @@ -55,7 +56,8 @@ public interface CredentialsService { * @return The credentials with the given ID * @throws CredentialsServiceException - if an unexpected exception occures. */ - Optional lookupCredentials(String applicationId, String credentialsId) throws CredentialsServiceException; + Optional lookupCredentials(String applicationId, String credentialsId) + throws CredentialsServiceException; /** * Sets the status of the given credentials to @@ -63,9 +65,11 @@ public interface CredentialsService { * * @param applicationId The application ID * @param credentialsId The credentials ID - * @throws CredentialsServiceException - if the credentials are not {@link CredentialsStatus#AVAILABLE}. + * @throws CredentialsServiceException - if the credentials are not + * {@link CredentialsStatus#AVAILABLE}. */ - void markCredentialsInUse(String applicationId, String credentialsId) throws CredentialsServiceException; + void markCredentialsInUse(String applicationId, String credentialsId) + throws CredentialsServiceException; /** * Revokes the given credentials by setting their status to @@ -73,7 +77,8 @@ public interface CredentialsService { * * @param applicationId The application ID * @param credentialsId The credentials ID - * @throws CredentialsServiceException - if an unexpected exception occures. + * @throws CredentialsServiceException - if an unexpected exception occurs. */ - void markCredentialsRevoked(String applicationId, String credentialsId) throws CredentialsServiceException; + void markCredentialsRevoked(String applicationId, String credentialsId) + throws CredentialsServiceException; } diff --git a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/EndpointService.java b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/EndpointService.java index 23cd75821c..7f08297f46 100644 --- a/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/EndpointService.java +++ b/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/EndpointService.java @@ -126,7 +126,8 @@ public interface EndpointService { * @param endpointConfigurationDto the endpoint configuration dto * @return the endpoint configuration dto */ - EndpointConfigurationDto saveEndpointConfiguration(EndpointConfigurationDto endpointConfigurationDto); + EndpointConfigurationDto saveEndpointConfiguration( + EndpointConfigurationDto endpointConfigurationDto); /** * Find endpoint profile by key hash. @@ -153,7 +154,7 @@ public interface EndpointService { TopicListEntryDto findTopicListEntryByHash(byte[] hash); /** - * Save topic list entry + * Save topic list entry. * * @param topicListEntryDto the endpoint list entry dto * @return the topic list entry dto @@ -190,7 +191,8 @@ public interface EndpointService { * @param profile the profile * @return the endpoint profile dto */ - EndpointProfileDto attachEndpointToUser(String userExternalId, String tenantId, EndpointProfileDto profile); + EndpointProfileDto attachEndpointToUser(String userExternalId, String tenantId, + EndpointProfileDto profile); /** * Attach endpoint profile to user. @@ -200,15 +202,21 @@ public interface EndpointService { * @return the endpoint profile dto */ - @Retryable(maxAttempts = 10, backoff = @Backoff(delay = 100), value = {KaaOptimisticLockingFailureException.class}) - EndpointProfileDto attachEndpointToUser(String endpointUserId, String endpointAccessToken) throws KaaOptimisticLockingFailureException; + @Retryable(maxAttempts = 10, + backoff = @Backoff(delay = 100), + value = {KaaOptimisticLockingFailureException.class} + ) + EndpointProfileDto attachEndpointToUser(String endpointUserId, String endpointAccessToken) + throws KaaOptimisticLockingFailureException; /** * Detach endpoint profile from user. * * @param detachEndpoint the detach endpoint */ - @Retryable(maxAttempts = 10, backoff = @Backoff(delay = 100), value = {KaaOptimisticLockingFailureException.class}) + @Retryable(maxAttempts = 10, + backoff = @Backoff(delay = 100), + value = {KaaOptimisticLockingFailureException.class}) void detachEndpointFromUser(EndpointProfileDto detachEndpoint); /** @@ -259,7 +267,8 @@ public interface EndpointService { * @param tenantId the tenant id * @return the list of endpoint profiles */ - List findEndpointProfilesByExternalIdAndTenantId(String externalId, String tenantId); + List findEndpointProfilesByExternalIdAndTenantId(String externalId, + String tenantId); /** * Returns the default group for the given application. diff --git a/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/sync/platform/package-info.java b/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/sync/platform/package-info.java index 881ba7ad19..199ee5b3a9 100644 --- a/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/sync/platform/package-info.java +++ b/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/sync/platform/package-info.java @@ -16,7 +16,8 @@ /** * Provides classes and interfaces used to decode platform level data to {@link - * org.kaaproject.kaa.server.sync.ClientSync} and encode {@link org.kaaproject.kaa.server.sync.ServerSync} + * org.kaaproject.kaa.server.sync.ClientSync} and encode + * {@link org.kaaproject.kaa.server.sync.ServerSync} */ package org.kaaproject.kaa.server.sync.platform; diff --git a/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/NeighborConnection.java b/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/NeighborConnection.java index 4012cafd33..846f8dd112 100644 --- a/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/NeighborConnection.java +++ b/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/NeighborConnection.java @@ -58,7 +58,6 @@ */ public final class NeighborConnection, V> { - private static final Logger LOG = LoggerFactory.getLogger(NeighborConnection.class); /** @@ -120,7 +119,7 @@ public NeighborConnection(ConnectionInfo connectionInfo, int maxNumberConnection this.maxNumberConnection = maxNumberConnection; this.socketTimeout = socketTimeout; this.template = template; - this.id = Neighbors.getServerID(connectionInfo); + this.id = Neighbors.getServerId(connectionInfo); } public NeighborConnection(ConnectionInfo connectionInfo, diff --git a/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/NeighborTemplate.java b/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/NeighborTemplate.java index 12643aaf90..b6f3370574 100644 --- a/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/NeighborTemplate.java +++ b/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/NeighborTemplate.java @@ -25,6 +25,6 @@ public interface NeighborTemplate { void process(OperationsThriftService.Iface client, List messages) throws TException; - void onServerError(String serverId, Exception e); + void onServerError(String serverId, Exception ex); } diff --git a/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/Neighbors.java b/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/Neighbors.java index fc2c95ba40..e822d4071d 100644 --- a/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/Neighbors.java +++ b/server/common/server-shared/src/main/java/org/kaaproject/kaa/server/thrift/Neighbors.java @@ -41,9 +41,6 @@ */ public class Neighbors, V> { - /** - * The Constant LOG. - */ private static final Logger LOG = LoggerFactory.getLogger(Neighbors.class); private final KaaThriftService serviceType; @@ -73,8 +70,8 @@ public Neighbors(KaaThriftService serviceType, T template, int maxNumberNeighbor * @param info ConnectionInfo * @return server ID in format thriftHost:thriftPort */ - public static String getServerID(ConnectionInfo info) { - return getServerID(KaaThriftService.OPERATIONS_SERVICE, info); + public static String getServerId(ConnectionInfo info) { + return getServerId(KaaThriftService.OPERATIONS_SERVICE, info); } /** @@ -84,7 +81,7 @@ public static String getServerID(ConnectionInfo info) { * @param info ConnectionInfo * @return server ID in format thriftHost:thriftPort */ - public static String getServerID(KaaThriftService service, ConnectionInfo info) { + public static String getServerId(KaaThriftService service, ConnectionInfo info) { StringBuffer sb = new StringBuffer(); sb.append(info.getThriftHost()); sb.append(":"); @@ -99,16 +96,16 @@ public void sendMessage(ConnectionInfo info, V msg) { } public void sendMessages(ConnectionInfo info, Collection msg) { - NeighborConnection neighbor = neigbors.get(getServerID(info)); + NeighborConnection neighbor = neigbors.get(getServerId(info)); if (neighbor != null) { try { neighbor.sendMessages(msg); - } catch (InterruptedException e) { + } catch (InterruptedException ex) { LOG.error("Failed to send message to {}", neighbor.getId()); - throw new RuntimeException(e); + throw new RuntimeException(ex); } } else { - LOG.warn("Can't find server for id {}", getServerID(info)); + LOG.warn("Can't find server for id {}", getServerId(info)); } } @@ -124,7 +121,7 @@ public void brodcastMessages(Collection msgs) { LOG.trace("Broadcasting to {} neighbor", neighbor); try { neighbor.sendMessages(msgs); - } catch (InterruptedException e) { + } catch (InterruptedException ex) { LOG.warn("Failed to send message to {}", neighbor.getId()); } } @@ -144,14 +141,13 @@ public void shutdown() { /** * Return current list of Neighbors. * - * @return List neighbors. */ public List> getNeighbors() { return new LinkedList>(neigbors.values()); } /** - * Return specific Neighbor connection by Id + * Return specific Neighbor connection by Id. * * @param serverId String in format thriftHost:thriftPort * @return NeighborConnection or null if such server not exist @@ -160,8 +156,9 @@ public NeighborConnection getNeghborConnection(String serverId) { return neigbors.get(serverId); } - public void setZkNode(KaaThriftService service, ConnectionInfo connectionInfo, WorkerNodeTracker zkNode) { - setZkNode(getServerID(service, connectionInfo), zkNode); + public void setZkNode(KaaThriftService service, ConnectionInfo connectionInfo, + WorkerNodeTracker zkNode) { + setZkNode(getServerId(service, connectionInfo), zkNode); } /** @@ -185,13 +182,14 @@ public void onNodeAdded(OperationsNodeInfo nodeInfo) { @Override public void onNodeRemoved(OperationsNodeInfo nodeInfo) { - String opId = getServerID(nodeInfo.getConnectionInfo()); + String opId = getServerId(nodeInfo.getConnectionInfo()); if (!zkId.equals(opId)) { NeighborConnection connection = neigbors.remove(opId); if (connection != null) { connection.shutdown(); } - LOG.info("Operations server {} removed to {} Neighbors list ({}). Now {} neighbors", opId, neigbors.size()); + LOG.info("Operations server {} removed to {} Neighbors list ({}). Now {} neighbors", + opId, neigbors.size()); } } }); @@ -205,12 +203,15 @@ public void onNodeRemoved(OperationsNodeInfo nodeInfo) { private void addOpsServer(OperationsNodeInfo opServer) { LOG.trace("[{}] Building id for {}", zkId, opServer.getConnectionInfo()); - String opId = getServerID(serviceType, opServer.getConnectionInfo()); + String opId = getServerId(serviceType, opServer.getConnectionInfo()); if (!zkId.equals(opId)) { LOG.trace("Adding {} to {}", opId, neigbors); - neigbors.putIfAbsent(opId, new NeighborConnection(opServer.getConnectionInfo(), maxNumberNeighborConnections, template)); + neigbors.putIfAbsent(opId, new NeighborConnection(opServer.getConnectionInfo(), + maxNumberNeighborConnections, template)); + neigbors.get(opId).start(); - LOG.info("Operations server {} added/updated to {} Neighbors list. Now {} neighbors", opId, zkId, neigbors.size()); + LOG.info("Operations server {} added/updated to {} Neighbors list. Now {} neighbors", + opId, zkId, neigbors.size()); } } } diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/DefaultControlService.java b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/DefaultControlService.java index c1270c4c2f..4e3e0aa308 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/DefaultControlService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/DefaultControlService.java @@ -932,7 +932,7 @@ public void editUserConfiguration(EndpointUserConfigurationDto configuration) configuration.getUserId(), configuration.getAppToken(), configuration.getSchemaVersion(), hash.getDataBuf()); if (LOG.isTraceEnabled()) { - LOG.trace("Sending message {} to [{}]", msg, Neighbors.getServerID( + LOG.trace("Sending message {} to [{}]", msg, Neighbors.getServerId( server.getConnectionInfo())); } neighbors.sendMessage(server.getConnectionInfo(), OperationsServiceMsg.fromUpdate(msg)); @@ -1583,7 +1583,7 @@ public EndpointNotificationDto editUnicastNotification(EndpointNotificationDto n nf.setNotificationId(notificationDto.getId()); if (LOG.isTraceEnabled()) { LOG.trace("Sending message {} to [{}]", - nf, Neighbors.getServerID(server.getConnectionInfo())); + nf, Neighbors.getServerId(server.getConnectionInfo())); } neighbors.sendMessage(server.getConnectionInfo(), OperationsServiceMsg.fromNotification(nf)); } else { @@ -1618,7 +1618,7 @@ public EndpointProfileDto updateServerProfile(String endpointKeyHash, int versio nf.setActorClassifier(ThriftActorClassifier.GLOBAL); if (LOG.isTraceEnabled()) { LOG.trace("Sending message {} to [{}]", - nf, Neighbors.getServerID(server.getConnectionInfo())); + nf, Neighbors.getServerId(server.getConnectionInfo())); } neighbors.sendMessage(server.getConnectionInfo(), OperationsServiceMsg.fromServerProfileUpdateMessage(nf)); diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/exception/ControlServiceException.java b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/exception/ControlServiceException.java index b4328450f4..6334a291ec 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/exception/ControlServiceException.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/exception/ControlServiceException.java @@ -24,8 +24,8 @@ public ControlServiceException(String message) { super(message); } - public ControlServiceException(Exception e) { - super(e); + public ControlServiceException(Exception ex) { + super(ex); } } diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/sdk/SdkGenerator.java b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/sdk/SdkGenerator.java index b3b8aa8622..96ce3c846d 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/control/service/sdk/SdkGenerator.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/control/service/sdk/SdkGenerator.java @@ -31,14 +31,10 @@ import java.io.InputStreamReader; import java.util.List; -/** - * The Class SdkGenerator. - */ + public abstract class SdkGenerator { - /** - * The Constant LOG. - */ + private static final Logger LOG = LoggerFactory.getLogger(SdkGenerator.class); /** @@ -62,10 +58,10 @@ static String readFile(File file) throws IOException { } reader.close(); result = fileData.toString(); - } catch (IOException e) { + } catch (IOException ex) { LOG.error("Unable to read from specified file '" - + file + "'! Error: " + e.getMessage(), e); - throw e; + + file + "'! Error: " + ex.getMessage(), ex); + throw ex; } return result; } @@ -78,10 +74,11 @@ static String readFile(File file) throws IOException { * @throws IOException Signals that an I/O exception has occurred. */ public static String readResource(String resource) throws IOException { - String result = null; + String result; try { StringBuffer fileData = new StringBuffer(); - InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); + InputStream input = Thread.currentThread() + .getContextClassLoader().getResourceAsStream(resource); BufferedReader reader = new BufferedReader(new InputStreamReader(input)); char[] buf = new char[1024]; int numRead = 0; @@ -91,10 +88,10 @@ public static String readResource(String resource) throws IOException { } reader.close(); result = fileData.toString(); - } catch (IOException e) { + } catch (IOException ex) { LOG.error("Unable to read from specified resource '" - + resource + "'! Error: " + e.getMessage(), e); - throw e; + + resource + "'! Error: " + ex.getMessage(), ex); + throw ex; } return result; } diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/node/service/credentials/CredentialsServiceAdapter.java b/server/node/src/main/java/org/kaaproject/kaa/server/node/service/credentials/CredentialsServiceAdapter.java index 9add009586..f946c3ded9 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/node/service/credentials/CredentialsServiceAdapter.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/node/service/credentials/CredentialsServiceAdapter.java @@ -39,18 +39,22 @@ public final class CredentialsServiceAdapter implements CredentialsService { * @param applicationId The application ID * @param credentialsService The internal credentials service used by Kaa */ - public CredentialsServiceAdapter(String applicationId, org.kaaproject.kaa.server.common.dao.CredentialsService credentialsService) { + public CredentialsServiceAdapter( + String applicationId, + org.kaaproject.kaa.server.common.dao.CredentialsService credentialsService) { this.applicationId = applicationId; this.credentialsService = credentialsService; } @Override - public CredentialsDto provideCredentials(CredentialsDto credentials) throws CredentialsServiceException { + public CredentialsDto provideCredentials(CredentialsDto credentials) + throws CredentialsServiceException { return credentialsService.provideCredentials(applicationId, credentials); } @Override - public Optional lookupCredentials(String credentialsId) throws CredentialsServiceException { + public Optional lookupCredentials(String credentialsId) + throws CredentialsServiceException { return credentialsService.lookupCredentials(applicationId, credentialsId); } diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/node/service/credentials/DefaultCredentialsServiceLocator.java b/server/node/src/main/java/org/kaaproject/kaa/server/node/service/credentials/DefaultCredentialsServiceLocator.java index bf60b8d2b1..be3e2f5496 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/node/service/credentials/DefaultCredentialsServiceLocator.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/node/service/credentials/DefaultCredentialsServiceLocator.java @@ -38,7 +38,8 @@ * @since v0.9.0 */ @Service("rootCredentialsServiceLocator") -public final class DefaultCredentialsServiceLocator implements CredentialsServiceLocator, CredentialsServiceRegistry { +public final class DefaultCredentialsServiceLocator + implements CredentialsServiceLocator, CredentialsServiceRegistry { public static final String DEFAULT_CREDENTIALS_SERVICE_NAME = "Trustful"; private static final Logger LOG = LoggerFactory.getLogger(DefaultCredentialsServiceLocator.class); @@ -53,11 +54,13 @@ public CredentialsService getCredentialsService(String applicationId) { String serviceName = this.cacheService.findAppById(applicationId).getCredentialsServiceName(); if (StringUtils.isBlank(serviceName)) { serviceName = DEFAULT_CREDENTIALS_SERVICE_NAME; - LOG.debug("No credentials service configured for application [{}], using [{}]", applicationId, serviceName); + LOG.debug("No credentials service configured for application [{}], using [{}]", + applicationId, serviceName); } CredentialsServiceLocator locator = credentialsServiceLocatorMap.get(serviceName); if (locator == null) { - throw new IllegalStateException("Can't find credentials service factory for name: " + serviceName); + throw new IllegalStateException("Can't find credentials service factory for name: " + + serviceName); } else { return locator.getCredentialsService(applicationId); } @@ -65,6 +68,8 @@ public CredentialsService getCredentialsService(String applicationId) { @Override public List getCredentialsServiceNames() { - return this.credentialsServiceLocatorMap.keySet().stream().sorted().collect(Collectors.toList()); + return this.credentialsServiceLocatorMap.keySet().stream() + .sorted() + .collect(Collectors.toList()); } } diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cluster/DefaultClusterService.java b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cluster/DefaultClusterService.java index cd78541d42..4a85ad20fe 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cluster/DefaultClusterService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/cluster/DefaultClusterService.java @@ -110,7 +110,7 @@ public String getNodeId() { @Override public void setZkNode(OperationsNode operationsNode) { this.operationsNode = operationsNode; - this.id = Neighbors.getServerID(this.operationsNode.getNodeInfo().getConnectionInfo()); + this.id = Neighbors.getServerId(this.operationsNode.getNodeInfo().getConnectionInfo()); neighbors.setZkNode(KaaThriftService.OPERATIONS_SERVICE, this.operationsNode.getNodeInfo().getConnectionInfo(), operationsNode); if (resolver != null) { updateResolver(this.resolver); @@ -176,7 +176,7 @@ public boolean isMainEntityNode(byte[] entityId) { if (info == null) { return false; } - String nodeId = Neighbors.getServerID(info.getConnectionInfo()); + String nodeId = Neighbors.getServerId(info.getConnectionInfo()); LOG.trace("Comparing {} to {} for entity {}", id, nodeId, entityIdStr); return id.equals(nodeId); @@ -191,7 +191,7 @@ public String getEntityNode(EndpointObjectHash entityId) { public String getEntityNode(byte[] entityId) { OperationsNodeInfo info = resolver.getNode(Base64Util.encode(entityId)); if (info != null) { - return Neighbors.getServerID(info.getConnectionInfo()); + return Neighbors.getServerId(info.getConnectionInfo()); } return null; } @@ -356,7 +356,7 @@ public void process(Iface client, List messages) throws TE } @Override - public void onServerError(String serverId, Exception e) { + public void onServerError(String serverId, Exception ex) { LOG.warn("Failed to send data to [{}]", serverId); } } diff --git a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/event/DefaultEventService.java b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/event/DefaultEventService.java index 99ece677b3..9c02e6d698 100644 --- a/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/event/DefaultEventService.java +++ b/server/node/src/main/java/org/kaaproject/kaa/server/operations/service/event/DefaultEventService.java @@ -350,7 +350,7 @@ public void sendEventMessage(List messages) { @Override public void sendEndpointRouteInfo(GlobalRouteInfo routeInfo) { LOG.trace("calculating server for user {}", routeInfo.getUserId()); - String serverId = Neighbors.getServerID(resolver.getNode(routeInfo.getUserId()).getConnectionInfo()); + String serverId = Neighbors.getServerId(resolver.getNode(routeInfo.getUserId()).getConnectionInfo()); sendMessagesToServer(packMessage(routeInfo), serverId); } @@ -366,14 +366,14 @@ public boolean isMainUserNode(String userId) { return false; } LOG.trace("comparing {} to {} for user {}", id, info.getConnectionInfo(), userId); - return id.equals(Neighbors.getServerID(info.getConnectionInfo())); + return id.equals(Neighbors.getServerId(info.getConnectionInfo())); } @Override public String getUserNode(String userId) { OperationsNodeInfo info = resolver.getNode(userId); if (info != null) { - return Neighbors.getServerID(info.getConnectionInfo()); + return Neighbors.getServerId(info.getConnectionInfo()); } return null; } @@ -388,7 +388,7 @@ public String getUserNode(String userId) { @Override public void setZkNode(OperationsNode operationsNode) { this.operationsNode = operationsNode; - this.id = Neighbors.getServerID(KaaThriftService.OPERATIONS_SERVICE, this.operationsNode.getNodeInfo().getConnectionInfo()); + this.id = Neighbors.getServerId(KaaThriftService.OPERATIONS_SERVICE, this.operationsNode.getNodeInfo().getConnectionInfo()); neighbors.setZkNode(KaaThriftService.OPERATIONS_SERVICE, this.operationsNode.getNodeInfo().getConnectionInfo(), operationsNode); if (resolver != null) { updateResolver(this.resolver); @@ -675,7 +675,7 @@ public void process(Iface client, List messages) throws TException { } @Override - public void onServerError(String serverId, Exception e) { + public void onServerError(String serverId, Exception ex) { service.notifyListenersOnServerProblem(serverId); } }