PageRenderTime 25ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/thirdparty/breakpad/third_party/protobuf/protobuf/java/src/main/java/com/google/protobuf/RpcController.java

http://github.com/tomahawk-player/tomahawk
Java | 118 lines | 10 code | 10 blank | 98 comment | 0 complexity | 44d21c039feedf7c387b756b2679f1fa MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-3.0, GPL-2.0
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2008 Google Inc. All rights reserved.
  3. // http://code.google.com/p/protobuf/
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are
  7. // met:
  8. //
  9. // * Redistributions of source code must retain the above copyright
  10. // notice, this list of conditions and the following disclaimer.
  11. // * Redistributions in binary form must reproduce the above
  12. // copyright notice, this list of conditions and the following disclaimer
  13. // in the documentation and/or other materials provided with the
  14. // distribution.
  15. // * Neither the name of Google Inc. nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. package com.google.protobuf;
  31. /**
  32. * <p>An {@code RpcController} mediates a single method call. The primary
  33. * purpose of the controller is to provide a way to manipulate settings
  34. * specific to the RPC implementation and to find out about RPC-level errors.
  35. *
  36. * <p>Starting with version 2.3.0, RPC implementations should not try to build
  37. * on this, but should instead provide code generator plugins which generate
  38. * code specific to the particular RPC implementation. This way the generated
  39. * code can be more appropriate for the implementation in use and can avoid
  40. * unnecessary layers of indirection.
  41. *
  42. * <p>The methods provided by the {@code RpcController} interface are intended
  43. * to be a "least common denominator" set of features which we expect all
  44. * implementations to support. Specific implementations may provide more
  45. * advanced features (e.g. deadline propagation).
  46. *
  47. * @author kenton@google.com Kenton Varda
  48. */
  49. public interface RpcController {
  50. // -----------------------------------------------------------------
  51. // These calls may be made from the client side only. Their results
  52. // are undefined on the server side (may throw RuntimeExceptions).
  53. /**
  54. * Resets the RpcController to its initial state so that it may be reused in
  55. * a new call. This can be called from the client side only. It must not
  56. * be called while an RPC is in progress.
  57. */
  58. void reset();
  59. /**
  60. * After a call has finished, returns true if the call failed. The possible
  61. * reasons for failure depend on the RPC implementation. {@code failed()}
  62. * most only be called on the client side, and must not be called before a
  63. * call has finished.
  64. */
  65. boolean failed();
  66. /**
  67. * If {@code failed()} is {@code true}, returns a human-readable description
  68. * of the error.
  69. */
  70. String errorText();
  71. /**
  72. * Advises the RPC system that the caller desires that the RPC call be
  73. * canceled. The RPC system may cancel it immediately, may wait awhile and
  74. * then cancel it, or may not even cancel the call at all. If the call is
  75. * canceled, the "done" callback will still be called and the RpcController
  76. * will indicate that the call failed at that time.
  77. */
  78. void startCancel();
  79. // -----------------------------------------------------------------
  80. // These calls may be made from the server side only. Their results
  81. // are undefined on the client side (may throw RuntimeExceptions).
  82. /**
  83. * Causes {@code failed()} to return true on the client side. {@code reason}
  84. * will be incorporated into the message returned by {@code errorText()}.
  85. * If you find you need to return machine-readable information about
  86. * failures, you should incorporate it into your response protocol buffer
  87. * and should NOT call {@code setFailed()}.
  88. */
  89. void setFailed(String reason);
  90. /**
  91. * If {@code true}, indicates that the client canceled the RPC, so the server
  92. * may as well give up on replying to it. This method must be called on the
  93. * server side only. The server should still call the final "done" callback.
  94. */
  95. boolean isCanceled();
  96. /**
  97. * Asks that the given callback be called when the RPC is canceled. The
  98. * parameter passed to the callback will always be {@code null}. The
  99. * callback will always be called exactly once. If the RPC completes without
  100. * being canceled, the callback will be called after completion. If the RPC
  101. * has already been canceled when NotifyOnCancel() is called, the callback
  102. * will be called immediately.
  103. *
  104. * <p>{@code notifyOnCancel()} must be called no more than once per request.
  105. * It must be called on the server side only.
  106. */
  107. void notifyOnCancel(RpcCallback<Object> callback);
  108. }