net.spy.memcached.compat.log.Logger.error()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(273)

本文整理了Java中net.spy.memcached.compat.log.Logger.error()方法的一些代码示例,展示了Logger.error()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()方法的具体详情如下:
包路径:net.spy.memcached.compat.log.Logger
类名称:Logger
方法名:error

Logger.error介绍

[英]Log a message at error level.
[中]在错误级别记录消息。

代码示例

代码示例来源:origin: Netflix/EVCache

  1. public void shutdown() {
  2. removeMonitoring();
  3. writeQ.clear();
  4. readQ.clear();
  5. inputQueue.clear();
  6. try {
  7. // Cleanup the ByteBuffers only if they are sun.nio.ch.DirectBuffer
  8. // If we don't cleanup then we will leak 16K of memory
  9. if (getRbuf() instanceof DirectBuffer) {
  10. Cleaner cleaner = ((DirectBuffer) getRbuf()).cleaner();
  11. if (cleaner != null) cleaner.clean();
  12. cleaner = ((DirectBuffer) getWbuf()).cleaner();
  13. if (cleaner != null) cleaner.clean();
  14. }
  15. } catch (Throwable t) {
  16. getLogger().error("Exception cleaning ByteBuffer.", t);
  17. }
  18. }

代码示例来源:origin: com.couchbase.client/couchbase-client

  1. @Override
  2. public void run() {
  3. try {
  4. ioReactor.execute(ioEventDispatch);
  5. } catch (InterruptedIOException ex) {
  6. getLogger().error("I/O reactor Interrupted", ex);
  7. } catch (IOException e) {
  8. getLogger().error("I/O error: " + e.getMessage(), e);
  9. }
  10. getLogger().debug("I/O reactor terminated");
  11. }
  12. }, "Couchbase ClusterManager Thread");

代码示例来源:origin: com.couchbase.client/couchbase-client

  1. @Override
  2. public void run() {
  3. try {
  4. ioReactor.execute(ioEventDispatch);
  5. } catch (InterruptedIOException ex) {
  6. getLogger().error("I/O reactor Interrupted", ex);
  7. } catch (IOException e) {
  8. getLogger().error("I/O error: " + e.getMessage(), e);
  9. }
  10. getLogger().info("I/O reactor terminated");
  11. }
  12. }, "Couchbase View Thread");

代码示例来源:origin: naver/arcus-java-client

  1. static List<InetSocketAddress> getAddresses(String s) {
  2. List<InetSocketAddress> list = null;
  3. try {
  4. list = parseNodeNames(s);
  5. } catch (Exception e) {
  6. // May see an exception if nodes do not follow the replication naming convention
  7. ArcusClient.arcusLogger.error("Exception caught while parsing node" +
  8. " addresses. cache_list=" + s + "\n" + e);
  9. e.printStackTrace();
  10. list = null;
  11. }
  12. // Return at least one node in all cases. Otherwise we may see unexpected null pointer
  13. // exceptions throughout this client library...
  14. if (list == null || list.size() == 0) {
  15. list = new ArrayList<InetSocketAddress>(1);
  16. list.add((InetSocketAddress) ArcusReplNodeAddress.createFake(null));
  17. }
  18. return list;
  19. }

代码示例来源:origin: com.couchbase.client/couchbase-client

  1. /**
  2. * Helper method to parse a node {@link Status} out of the raw response.
  3. *
  4. * @param status the status to parse.
  5. * @return the parsed status enum value.
  6. */
  7. private Status parseNodeStatus(String status) {
  8. if (status == null || status.isEmpty()) {
  9. return null;
  10. }
  11. try {
  12. return Status.valueOf(status);
  13. } catch (IllegalArgumentException e) {
  14. getLogger().error("Unknown status value: " + status);
  15. return null;
  16. }
  17. }

代码示例来源:origin: net.spy/spymemcached

  1. /**
  2. * Make sure channel connections are not leaked and properly close under
  3. * faulty reconnect cirumstances.
  4. *
  5. * @param ch the channel to potentially close.
  6. * @param node the node to which the channel should be bound to.
  7. */
  8. private void potentiallyCloseLeakingChannel(final SocketChannel ch,
  9. final MemcachedNode node) {
  10. if (ch != null && !ch.isConnected() && !ch.isConnectionPending()) {
  11. try {
  12. ch.close();
  13. } catch (IOException e) {
  14. getLogger().error("Exception closing channel: %s", node, e);
  15. }
  16. }
  17. }

代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client

  1. /**
  2. * Make sure channel connections are not leaked and properly close under
  3. * faulty reconnect cirumstances.
  4. *
  5. * @param ch the channel to potentially close.
  6. * @param node the node to which the channel should be bound to.
  7. */
  8. private void potentiallyCloseLeakingChannel(final SocketChannel ch,
  9. final MemcachedNode node) {
  10. if (ch != null && !ch.isConnected() && !ch.isConnectionPending()) {
  11. try {
  12. ch.close();
  13. } catch (IOException e) {
  14. getLogger().error("Exception closing channel: %s", node, e);
  15. }
  16. }
  17. }

代码示例来源:origin: com.couchbase.client/couchbase-client

  1. /**
  2. * Shuts down the active {@link ViewConnection}.
  3. *
  4. * @return false if a shutdown attempt is already in progress, true otherwise.
  5. * @throws IOException if the reactor cannot be shut down properly.
  6. */
  7. public boolean shutdown() throws IOException {
  8. if (!running) {
  9. getLogger().info("Suppressing duplicate attempt to shut down");
  10. return false;
  11. }
  12. running = false;
  13. ioReactor.shutdown();
  14. try {
  15. reactorThread.join(0);
  16. } catch (InterruptedException ex) {
  17. getLogger().error("Interrupt " + ex + " received while waiting for "
  18. + "view thread to shut down.");
  19. }
  20. return true;
  21. }

代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client

  1. /**
  2. * Set the continuous timeout on an operation.
  3. *
  4. * Ignore operations which have no handling nodes set yet (which may happen before nodes are properly
  5. * authenticated).
  6. *
  7. * @param op the operation to use.
  8. * @param isTimeout is timed out or not.
  9. */
  10. private static void setTimeout(final Operation op, final boolean isTimeout) {
  11. Logger logger = LoggerFactory.getLogger(MemcachedConnection.class);
  12. try {
  13. if (op == null || op.isTimedOutUnsent()) {
  14. return;
  15. }
  16. MemcachedNode node = op.getHandlingNode();
  17. if (node != null) {
  18. node.setContinuousTimeout(isTimeout);
  19. }
  20. } catch (Exception e) {
  21. logger.error(e.getMessage());
  22. }
  23. }

代码示例来源:origin: net.spy/spymemcached

  1. public Long decode(CachedData d) {
  2. if (FLAGS == d.getFlags()) {
  3. return tu.decodeLong(d.getData());
  4. } else {
  5. getLogger().error(
  6. "Unexpected flags for long: " + d.getFlags() + " wanted " + FLAGS);
  7. return null;
  8. }
  9. }

代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached

  1. public Long decode(CachedData d) {
  2. if (FLAGS == d.getFlags()) {
  3. return tu.decodeLong(d.getData());
  4. } else {
  5. getLogger().error(
  6. "Unexpected flags for long: " + d.getFlags() + " wanted " + FLAGS);
  7. return null;
  8. }
  9. }

代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client

  1. public Long decode(CachedData d) {
  2. if (FLAGS == d.getFlags()) {
  3. return tu.decodeLong(d.getData());
  4. } else {
  5. getLogger().error(
  6. "Unexpected flags for long: " + d.getFlags() + " wanted " + FLAGS);
  7. return null;
  8. }
  9. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/memcached

  1. public Long decode(CachedData d) {
  2. if (flags == d.getFlags()) {
  3. return tu.decodeLong(d.getData());
  4. } else {
  5. getLogger().error("Unexpected flags for long: "
  6. + d.getFlags() + " wanted " + flags);
  7. return null;
  8. }
  9. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached

  1. public Long decode(CachedData d) {
  2. if (flags == d.getFlags()) {
  3. return tu.decodeLong(d.getData());
  4. } else {
  5. getLogger().error("Unexpected flags for long: "
  6. + d.getFlags() + " wanted " + flags);
  7. return null;
  8. }
  9. }

代码示例来源:origin: naver/arcus-java-client

  1. public Long decode(CachedData d) {
  2. if (flags == d.getFlags()) {
  3. return tu.decodeLong(d.getData());
  4. } else {
  5. getLogger().error("Unexpected flags for long: "
  6. + d.getFlags() + " wanted " + flags);
  7. return null;
  8. }
  9. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached

  1. protected void handleError(OperationErrorType eType, String line)
  2. throws IOException {
  3. getLogger().error("Error: %s", line);
  4. switch(eType) {
  5. case GENERAL:
  6. exception=new OperationException();
  7. break;
  8. case SERVER:
  9. exception=new OperationException(eType, line);
  10. break;
  11. case CLIENT:
  12. exception=new OperationException(eType, line);
  13. break;
  14. default: assert false;
  15. }
  16. transitionState(OperationState.COMPLETE);
  17. throw exception;
  18. }

代码示例来源:origin: com.couchbase.client/couchbase-client

  1. @Override
  2. public void handleResponse(HttpResponse response) {
  3. String json = getEntityString(response);
  4. int errorcode = response.getStatusLine().getStatusCode();
  5. try {
  6. OperationStatus status = parseViewForStatus(json, errorcode);
  7. ViewResponse vr = null;
  8. if (status.isSuccess()) {
  9. vr = parseResult(json);
  10. } else {
  11. parseError(json, errorcode);
  12. }
  13. ((ViewCallback) callback).gotData(vr);
  14. callback.receivedStatus(status);
  15. } catch (ParseException e) {
  16. LOGGER.error("Failed to parse JSON in response: " + response + ": " + json);
  17. setException(new OperationException(OperationErrorType.GENERAL,
  18. "Error parsing JSON (" + e.getMessage() + "): " + json));
  19. }
  20. callback.complete();
  21. }

代码示例来源:origin: com.google.code.maven-play-plugin.spy/memcached

  1. protected void handleError(OperationErrorType eType, String line)
  2. throws IOException {
  3. getLogger().error("Error: %s", line);
  4. switch(eType) {
  5. case GENERAL:
  6. exception=new OperationException();
  7. break;
  8. case SERVER:
  9. exception=new OperationException(eType, line);
  10. break;
  11. case CLIENT:
  12. exception=new OperationException(eType, line);
  13. break;
  14. default: assert false;
  15. }
  16. transitionState(OperationState.COMPLETE);
  17. throw exception;
  18. }

代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached

  1. protected void handleError(OperationErrorType eType, String line)
  2. throws IOException {
  3. getLogger().error("Error: %s", line);
  4. switch (eType) {
  5. case GENERAL:
  6. exception = new OperationException();
  7. break;
  8. case SERVER:
  9. exception = new OperationException(eType, line);
  10. break;
  11. case CLIENT:
  12. exception = new OperationException(eType, line);
  13. break;
  14. default:
  15. assert false;
  16. }
  17. callback.receivedStatus(new OperationStatus(false,
  18. exception.getMessage()));
  19. transitionState(OperationState.COMPLETE);
  20. throw exception;
  21. }

代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client

  1. protected void handleError(OperationErrorType eType, String line)
  2. throws IOException {
  3. getLogger().error("Error: %s", line);
  4. switch (eType) {
  5. case GENERAL:
  6. exception = new OperationException();
  7. break;
  8. case SERVER:
  9. exception = new OperationException(eType, line);
  10. break;
  11. case CLIENT:
  12. exception = new OperationException(eType, line);
  13. break;
  14. default:
  15. assert false;
  16. }
  17. callback.receivedStatus(new OperationStatus(false,
  18. exception.getMessage(), StatusCode.ERR_INTERNAL));
  19. transitionState(OperationState.COMPLETE);
  20. throw exception;
  21. }

相关文章