Class JsonrpcRequest

    • Constructor Detail

      • JsonrpcRequest

        public JsonrpcRequest​(java.lang.String method)
        Creates a JsonrpcRequest with random UUID as id and DEFAULT_TIMEOUT_SECONDS timeout.
        Parameters:
        method - the JSON-RPC method
      • JsonrpcRequest

        public JsonrpcRequest​(java.lang.String method,
                              int timeout)
        Creates a JsonrpcRequest with random UUID as id.
        Parameters:
        method - the JSON-RPC method
        timeout - max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout
      • JsonrpcRequest

        public JsonrpcRequest​(java.lang.String method,
                              java.util.Optional<java.lang.Integer> timeout)
        Creates a JsonrpcRequest with random UUID as id.
        Parameters:
        method - the JSON-RPC method
        timeout - max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout, empty for DEFAULT_TIMEOUT_SECONDS timeout
      • JsonrpcRequest

        public JsonrpcRequest​(java.util.UUID id,
                              java.lang.String method,
                              java.util.Optional<java.lang.Integer> timeout)
        Creates a JsonrpcRequest.
        Parameters:
        id - the JSON-RPC id
        method - the JSON-RPC method
        timeout - max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout, empty for DEFAULT_TIMEOUT_SECONDS timeout
      • JsonrpcRequest

        protected JsonrpcRequest​(JsonrpcRequest request,
                                 java.lang.String method)
        Creates a JsonrpcRequest by copying and validating header information.
        • copies id and timeout
        • validates that the method names match
        Parameters:
        request - the template JSON-RPC Request
        method - the JSON-RPC method
      • JsonrpcRequest

        public JsonrpcRequest​(java.util.UUID id,
                              java.lang.String method,
                              int timeout)
        Creates a JsonrpcRequest.
        Parameters:
        id - the JSON-RPC id
        method - the JSON-RPC method
        timeout - max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout
    • Method Detail

      • getId

        public java.util.UUID getId()
        Gets the JSON-RPC id.
        Returns:
        the UUID id
      • getTimeout

        public java.util.Optional<java.lang.Integer> getTimeout()
        Gets the max time in seconds to wait for the JsonrpcResponse, negative or zero to disable timeout.
        Returns:
        the timeout in seconds