Return-Path: X-Original-To: apmail-river-dev-archive@www.apache.org Delivered-To: apmail-river-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D7D7517C1D for ; Fri, 12 Jun 2015 03:30:07 +0000 (UTC) Received: (qmail 92411 invoked by uid 500); 12 Jun 2015 03:30:07 -0000 Delivered-To: apmail-river-dev-archive@river.apache.org Received: (qmail 92381 invoked by uid 500); 12 Jun 2015 03:30:07 -0000 Mailing-List: contact dev-help@river.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@river.apache.org Delivered-To: mailing list dev@river.apache.org Received: (qmail 92369 invoked by uid 99); 12 Jun 2015 03:30:07 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2015 03:30:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id E79BCC095F for ; Fri, 12 Jun 2015 03:30:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.88 X-Spam-Level: ** X-Spam-Status: No, score=2.88 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ZKhqi81SeOLw for ; Fri, 12 Jun 2015 03:30:00 +0000 (UTC) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 5FFE724D0F for ; Fri, 12 Jun 2015 03:30:00 +0000 (UTC) Received: by wibdq8 with SMTP id dq8so4242894wib.1 for ; Thu, 11 Jun 2015 20:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=BYEkHgQr93qHA5q2uHcVty1bt5PsDeC8yMkn/AUwBUE=; b=iADXnRpHN6g2KLkbAUTh1yQUVtTHIdXsnLGNzxv7INXEFq93qDRaCh5re4yt0JrR/n yLWT+HDJRs9sS7rVM7QgFSBzig0N0tQjzfVjXFI6lHt6yEcpE6c19YVtE8HWVFBhnLhw 1cwTpCHVgaUnElYzHCaQd5UYrhNI/A4Lnv2x7GfSqo8VbyosPXc+DazhHEbfzoXCtWOP wVynbvknvLsG6fi8WTseVhyEVCBA9FhIuja6hYx4IA9ra8quOtiZHuxKnfv2tT6CyWMo Ny9/n4dA0KfssyJPxbvuwXJGVcpY1MHDWwetirJ9LWmJgTArropX+r8hmOlCquMq9VJL UIZA== MIME-Version: 1.0 X-Received: by 10.194.200.194 with SMTP id ju2mr21697907wjc.61.1434079793863; Thu, 11 Jun 2015 20:29:53 -0700 (PDT) Received: by 10.180.216.37 with HTTP; Thu, 11 Jun 2015 20:29:53 -0700 (PDT) In-Reply-To: <5579A0A2.7080901@travellinck.com> References: <55794A90.7080907@travellinck.com> <94AE2142-7EB0-4AF3-88FA-BFB3023CC3B5@stratuscom.com> <5579A0A2.7080901@travellinck.com> Date: Thu, 11 Jun 2015 23:29:53 -0400 Message-ID: Subject: Re: Using an unchecked exception instead of RemoteException From: Palash Ray To: dev@river.apache.org Content-Type: multipart/alternative; boundary=047d7b62499cb160b5051849b84b --047d7b62499cb160b5051849b84b Content-Type: text/plain; charset=UTF-8 My two cents: I am in favour of having runtime exception. We are facing a huge problem as our code base is too cluttered with this kind of code: try{ remoteProxy.callRemoteMethod(); } catch (RemoteException e){ } On Thu, Jun 11, 2015 at 10:52 AM, Dawid Loubser wrote: > On 11/06/2015 16:24, Greg Trasuk wrote: > >> * It's perfectly fine to still enforce service implementations to > >> declare RemoteException, as a "tag" / "reminder", but honestly, it's > >> not the client's concern. Depending on the reliability requirements > >> of the client, they need to handle unexpected failure in anyway, and > >> RemoteException is functionally no different than, say, a > NullPointer. > > I disagree. In my experience, communications exceptions need to be > carefully considered by the service consumer. > > Doesn't that effectively leave only two options? > > * Remote services can only implement, and be called via, contracts > that were designed at the time that I decided this will be a remote > service. No re-purposing or adapting of existing functionality to, > say, a new remote service. (i.e. I used to call a local database, > now I'm going to call a Jini service). > * "Just in case", make all methods on all contracts ever throw > RemoteException - although some frameworks like EJB 3.x won't like > that for certain types of services. Applying something to > everything, and to nothing, are semantically equivalent. > > Interfaces are supposed to promote plug-ability, right? I agree that > remote services are a leaky abstraction. Furthermore, Java's limited > type system does not give us elegant ways to re-use, say, the "business > semantics" of an interface in different contexts (such as, one that make > remote method calls). Because of this, I personally would rather have > the ability to strongly re-use interfaces in all contexts, across all > implementation technologies, where possible. > > If, at a given level of granularity, we strictly apply the semantic that > checked exceptions are for *service refusal* (precondition not met), and > RuntimeException and Error for *syst**em failure* (postcondition not > met, not caller's fault), things are a whole lot simpler in my opinion > and experience. > > Anyway, this has just been a big pain point for me all these years with > Jini/River. It has nothing to do with the "fallacies of distributed > computing", and everything with re-use, and the separation of > functionality from implementation technology in Java interfaces. > > If it were up to me, I would introduce an "UnexpectedRemoteException" > and/or "UnexpectedIOException" which both extend RuntimeException, and > which are understood by River components in addition to the usual > checked [Remote/IO]Exception - which, by defintion, is "expected". Then, > instead of arguing about one solution for an opinionated framework, the > users of the framework can choose, experiment, etc. I feel that River, > as infrastructure, should impede as little as possible, and a checked > RuntimeException is demonstrably limiting to e.g. interface re-use. > > warm regards, > Dawid Loubser > --047d7b62499cb160b5051849b84b--