From userboothjason@example.com Wed Dec 05 12:32:43 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 22916 invoked from network); 5 Dec 2007 12:32:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 5 Dec 2007 12:32:43 -0000 Received: (qmail 59854 invoked by uid 500); 5 Dec 2007 12:32:32 -0000 Delivered-To: boothjason@example.com Received: (qmail 59645 invoked by uid 500); 5 Dec 2007 12:32:31 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 59636 invoked by uid 99); 5 Dec 2007 12:32:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2007 04:32:31 -0800 X-ASF-Spam-Status: No, hits=-2.6 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [83.161.120.155] (HELO XSMTP0.ethz.ch) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2007 12:32:31 +0000 Received: from xfe1.d.ethz.ch ([83.161.120.155]) by XSMTP0.ethz.ch with Microsoft SMTPSVC(646)582-0504); Wed, 5 Dec 2007 13:32:11 +0100 Received: from [83.161.120.155] ([83.161.120.155]) by xfe1.d.ethz.ch over TLS secured channel with Microsoft SMTPSVC(646)582-0504); Wed, 5 Dec 2007 13:32:11 +0100 Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: <boothjason@example.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: boothjason@example.com From: Kaspar Fischer <boothjason@example.com> Subject: Using Hivemind to wrap a transaction around a request Date: Wed, 5 Dec 2007 13:32:09 +0100 X-Mailer: Apple Mail (2.752.3) X-OriginalArrivalTime: 05 Dec 2007 12:32:11.0501 (UTC) FILETIME=[DBC809D0:01C8373A] X-Virus-Checked: Checked by ClamAV on apache.org [Note: This is a cross-post; I have initially posted to the list boothjason@example.com but I guess the issue is more related to hivemind, so I post here.] Hi list, I need to wrap "begin transaction" and "end transaction" actions around a task (a Tapestry web request, actually). I've read about Hivemind, http://www.nabble.com/hivemind-factory-service-tf251931.html#a704856 and configured a service point (see below). This works very well: my transaction is created, but I cannot see when it is ended (committed/ rolled back). More precisely, I am struggling with: * What method is called on the object created by the factory when it is discarded? It is threadDidDiscardService(), right? * How can I catch exceptions from my actual task so that I can do a rollback instead of a commit? I am new to Hivemind, so please excuse these rather simple questions. Many thanks for you patience! Kaspar -- Here's my configuration: <service-point interface="org.my.tapestry.alfresco.AlfrescoTransactionContext" id="alfrescoContext"> <invoke-factory service-id="AlfrescoTransactionFactory" model="threaded" /> </service-point> <service-point interface="org.apache.hivemind.ServiceImplementationFactory" id="AlfrescoTransactionFactory" parameters-occurs="none"> <create-instance class="org.my.tapestry.alfresco.AlfrescoTransactionFactory" /> </service-point> Here is my factory: public class AlfrescoTransactionFactory implements ServiceImplementationFactory, Discardable { public Object createCoreServiceImplementation (ServiceImplementationFactoryParameters factoryParameters) { System.err.println("createCoreServiceImplementation"); // gets called! UserTransaction transaction; ServiceRegistry serviceRegistry; try { transaction = AlfrescoApplicationInitializer.createAndBeginAuthenticatedTransaction (true); serviceRegistry = AlfrescoApplicationInitializer.getServiceRegistry(); } catch (Exception e) { throw new ApplicationRuntimeException("Could not create an Alfresco transactoin.", e); } return new AlfrescoTransactionContextImpl(transaction, serviceRegistry); } public void threadDidDiscardService() { System.err.println("threadDidDiscardService"); // never called! // ... end the transaction here (todo) } } From userboothjason@example.com Wed Dec 05 13:10:23 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 41644 invoked from network); 5 Dec 2007 13:10:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 5 Dec 2007 13:10:23 -0000 Received: (qmail 288 invoked by uid 500); 5 Dec 2007 13:10:11 -0000 Delivered-To: boothjason@example.com Received: (qmail 272 invoked by uid 500); 5 Dec 2007 13:10:11 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 263 invoked by uid 99); 5 Dec 2007 13:10:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2007 05:10:11 -0800 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF boothjason@example.com) Received: from [83.161.120.155] (HELO smtp003.mail.ukl.yahoo.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 05 Dec 2007 13:10:09 +0000 Received: (qmail 6630 invoked from network); 5 Dec 2007 13:09:47 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Received:X-YMail-OSG:From:To:References:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:In-Reply-To:X-MimeOLE:Thread-Index; b=IXX9q50t+Lhh9z62mNPPH2QkFpVX4+jDOO2ID2LjW5wgTxVu8+wIklAggcOfblN4KsX0l4MRolGuSIuJFYE7z5YAdOsZH5xzGJVgKBz8ryXrudVLwNwF1naXec3hgFt7Dk6eYPaPqz3obUzGlurfyTk4gLDlfKFPReILawwYVj0= ; Received: from unknown (HELO VAIOSZ330) (boothjason@example.com with login) by smtp003.mail.ukl.yahoo.com with SMTP; 5 Dec 2007 13:09:45 -0000 X-YMail-OSG: QvGcqGsVM1n5UB7HI3wnftOewbwLjP6QH3scUgggvOeZQX03FvuAZqf81EGXt9hWrNsAOH_on4gI2NdWKH844KQiQjbbZwu3wH9d6iyY24ySLYi6 From: "Jean-Francois Poilpret" <boothjason@example.com> To: <boothjason@example.com> References: <boothjason@example.com> Subject: RE: Using Hivemind to wrap a transaction around a request Date: Wed, 5 Dec 2007 20:09:38 +0700 Message-ID: <000c01c83740$19e8c920$0301a8c0@VAIOSZ330> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <boothjason@example.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 Thread-Index: Acg3OvDwZaJxB2ZhQRarctwo4DSU3gABJDog X-Virus-Checked: Checked by ClamAV on apache.org Hi Kaspar, I think you'd rather take a look at HiveMind interceptors rather than factories. You can create an Interceptor that will be called before and after any method of another service. There are several ways to create interceptors in HiveMind, take a look at HiveMind website to see simple examples. If you want to see a real-life implementation of such a system you may take a look at hivetranse (http://hivetranse.sourceforge.net) which implements the same kind of behavior as you are looking for. I think you could quite easily adapt one of the numerous hivetranse interceptors (choose one -the simples- as an example). Cheers Jean-Francois -----Original Message----- From: Kaspar Fischer [mailto:boothjason@example.com] Sent: Wednesday, December 05, 2007 7:32 PM To: boothjason@example.com Subject: Using Hivemind to wrap a transaction around a request [Note: This is a cross-post; I have initially posted to the list boothjason@example.com but I guess the issue is more related to hivemind, so I post here.] Hi list, I need to wrap "begin transaction" and "end transaction" actions around a task (a Tapestry web request, actually). I've read about Hivemind, http://www.nabble.com/hivemind-factory-service-tf251931.html#a704856 and configured a service point (see below). This works very well: my transaction is created, but I cannot see when it is ended (committed/ rolled back). More precisely, I am struggling with: * What method is called on the object created by the factory when it is discarded? It is threadDidDiscardService(), right? * How can I catch exceptions from my actual task so that I can do a rollback instead of a commit? I am new to Hivemind, so please excuse these rather simple questions. Many thanks for you patience! Kaspar -- Here's my configuration: <service-point interface="org.my.tapestry.alfresco.AlfrescoTransactionContext" id="alfrescoContext"> <invoke-factory service-id="AlfrescoTransactionFactory" model="threaded" /> </service-point> <service-point interface="org.apache.hivemind.ServiceImplementationFactory" id="AlfrescoTransactionFactory" parameters-occurs="none"> <create-instance class="org.my.tapestry.alfresco.AlfrescoTransactionFactory" /> </service-point> Here is my factory: public class AlfrescoTransactionFactory implements ServiceImplementationFactory, Discardable { public Object createCoreServiceImplementation (ServiceImplementationFactoryParameters factoryParameters) { System.err.println("createCoreServiceImplementation"); // gets called! UserTransaction transaction; ServiceRegistry serviceRegistry; try { transaction = AlfrescoApplicationInitializer.createAndBeginAuthenticatedTransaction (true); serviceRegistry = AlfrescoApplicationInitializer.getServiceRegistry(); } catch (Exception e) { throw new ApplicationRuntimeException("Could not create an Alfresco transactoin.", e); } return new AlfrescoTransactionContextImpl(transaction, serviceRegistry); } public void threadDidDiscardService() { System.err.println("threadDidDiscardService"); // never called! // ... end the transaction here (todo) } } From userboothjason@example.com Thu Dec 06 17:58:39 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 89132 invoked from network); 6 Dec 2007 17:58:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 6 Dec 2007 17:58:39 -0000 Received: (qmail 35942 invoked by uid 500); 6 Dec 2007 17:58:28 -0000 Delivered-To: boothjason@example.com Received: (qmail 35722 invoked by uid 500); 6 Dec 2007 17:58:27 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 35713 invoked by uid 99); 6 Dec 2007 17:58:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Dec 2007 09:58:27 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [83.161.120.155] (HELO web33403.mail.mud.yahoo.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 06 Dec 2007 17:58:28 +0000 Received: (qmail 82187 invoked by uid 60001); 6 Dec 2007 17:58:07 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=Pf3CleupDsnC9GI5pTJtyqZ5ZCj/QpqUDfBAeNpdqvh6LPZoCK7tNxivrlM9Xm3UQo+zppWrUvTBTllZCXdP+kuC4iyQaDnKR+lzcZDibxc1efQVQW9aiMBWTFIJGB4KGDIgbBwJ606d0SooTZ5VmPqIua0mT/yUws8iQeLJT/Q=; X-YMail-OSG: m9LxnMkVM1kMdRkxpHYZQHHRrEnIUnCLUY165qCArn9xXjaobB5fxLjBhcE5LKkuzwx5u3HkUg-- Received: from [83.161.120.155] by web33403.mail.mud.yahoo.com via HTTP; Thu, 06 Dec 2007 09:58:07 PST X-Mailer: YahooMailRC/818.31 YahooMailWebService/83.161.120.155 Date: Thu, 6 Dec 2007 09:58:07 -0800 (PST) From: Trasca Virgil <boothjason@example.com> Subject: Expose HiveMind services as web-services To: boothjason@example.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <boothjason@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Hi all, For a project I will have 2 components - a server written in java(this will use hivemind) and a client written in C++ that will access the server with web services. I am totally new to HiveMind so maybe what I will ask is trivial. What is the simples way to expose the hivemind services as webservices? I am thinking to use Axis for this. So what I need is : 1) Expose the hivemind services as web-services . 2) If this web-services will be declared/exposed in a Java5 annot style even better. 3) If I will make somehow not to be "stuck-ed" with web-services even better. For example if in the future I will decide is better to go with xml-rpc, ideally it should be straightforward to re-deploy with this new way. But this is not so important. Point 1) is the most important one. Axis is the way to go or there are some better solutions? Are there samples with HiveMind and Axis? Thank you, Virgil From userboothjason@example.com Thu Dec 06 20:00:57 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 34291 invoked from network); 6 Dec 2007 20:00:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 6 Dec 2007 20:00:57 -0000 Received: (qmail 9031 invoked by uid 500); 6 Dec 2007 20:00:44 -0000 Delivered-To: boothjason@example.com Received: (qmail 9024 invoked by uid 500); 6 Dec 2007 20:00:44 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 9015 invoked by uid 99); 6 Dec 2007 20:00:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Dec 2007 12:00:44 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [83.161.120.155] (HELO mail.afip.gov.ar) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Dec 2007 20:00:47 +0000 Received: from gauss.correo.raiz.afip.gov.ar ([83.161.120.155]) by mail.afip.gov.ar with Microsoft SMTPSVC(646)582-0504); Thu, 6 Dec 2007 17:00:20 -0300 Received: from afipex01.correo.raiz.afip.gov.ar ([83.161.120.155]) by gauss.correo.raiz.afip.gov.ar with Microsoft SMTPSVC(646)582-0504); Thu, 6 Dec 2007 17:00:23 -0300 Received: from balrog ([83.161.120.155]) by afipex01.correo.raiz.afip.gov.ar with Microsoft SMTPSVC(646)582-0504); Thu, 6 Dec 2007 17:06:17 -0300 From: Pablo Lalloni <boothjason@example.com> Organization: AFIP/DDIT To: boothjason@example.com Subject: Re: Expose HiveMind services as web-services Date: Thu, 6 Dec 2007 17:00:20 -0300 User-Agent: KMail/1.9.7 Cc: Trasca Virgil <boothjason@example.com> References: <boothjason@example.com> In-Reply-To: <boothjason@example.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <boothjason@example.com> X-OriginalArrivalTime: 06 Dec 2007 20:06:17.0375 (UTC) FILETIME=[76003AF0:01C83843] X-Virus-Checked: Checked by ClamAV on apache.org I've done a lot of HiveMind services + (XMLRPC | Hessian) using HiveRemotin= g=20 but not web-services. See here http://hivetranse.sourceforge.net/web/quickstart.html#start.remoti= ng El Jue 06 Dic 2007, Trasca Virgil escribi=F3: > Hi all, > > For a project I will have 2 components - a server written in java(this > will use hivemind) and a client written in C++ that will access the server > with web services. I am totally new to HiveMind so maybe what I will ask = is > trivial. > > What is the simples way to expose the hivemind services as webservices? I > am thinking to use Axis for this. So what I need is : > > 1) Expose the hivemind services as web-services . > 2) If this web-services will be declared/exposed in a Java5 annot style > even better. 3) If I will make somehow not to be "stuck-ed" with > web-services even better. For example if in the future I will decide is > better to go with xml-rpc, ideally it should be straightforward to > re-deploy with this new way. But this is not so important. Point 1) is the > most important one. > > Axis is the way to go or there are some better solutions? Are there sampl= es > with HiveMind and Axis? > > Thank you, > Virgil =2D-=20 Pablo Lalloni From userboothjason@example.com Fri Dec 07 17:44:28 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 92493 invoked from network); 7 Dec 2007 17:44:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 7 Dec 2007 17:44:28 -0000 Received: (qmail 36355 invoked by uid 500); 7 Dec 2007 17:44:15 -0000 Delivered-To: boothjason@example.com Received: (qmail 36291 invoked by uid 500); 7 Dec 2007 17:44:14 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 36253 invoked by uid 99); 7 Dec 2007 17:44:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Dec 2007 09:44:14 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [83.161.120.155] (HELO web33404.mail.mud.yahoo.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 07 Dec 2007 17:43:52 +0000 Received: (qmail 96575 invoked by uid 60001); 7 Dec 2007 17:43:53 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=1eRL0z8N848h+r/Ki/1ayfbIcBE06vwf8ynLXg6wrKxLP70jJMd8JHm9rNaUJm9ab8PKsH/H5FdQOdUdCJ14jsFNgppL18bkM7mxvXZV7L9sOPNT4vaRYij+73Zav71WGrlYQkcBTNPJD1tMlUWYVyqG1MI+ntdxFg5yA0pbkuU=; X-YMail-OSG: bXCRmEEVM1llTF_J3eCDVxgsnaBdfFO3CmB4Ry_Od7v7LFXdnZk1A.8KQYf7g30y.w-- Received: from [83.161.120.155] by web33404.mail.mud.yahoo.com via HTTP; Fri, 07 Dec 2007 09:43:53 PST X-Mailer: YahooMailRC/818.31 YahooMailWebService/83.161.120.155 Date: Fri, 7 Dec 2007 09:43:53 -0800 (PST) From: Trasca Virgil <boothjason@example.com> Subject: Multithreading in HiveMind To: boothjason@example.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <boothjason@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Hi, I have a question related with how is multithrreading implemented in HiveMind. I know that HiveMind tries to "take the responsibility" of instantiating threads for the IoC components. I am new to HiveMind and if what I am saying is wrong please correct me. But on the other hand how is handled the following situation. I am trying to integrate Quartz (http://www.opensymphony.com/quartz/) into HiveMind framework. Quartz is also trying to manage the threads by his own claiming that the performance will be better and the user will not have any headaches with complicated stuff. So HiveMind is creating threads when he thinks is necessary in the same time Quartz creates some other threads when he thinks is necessary...and maybe I will also come with some other threads that I will consider I need. Is this a real risk to get a mess or I just don't have enough knowledge about HiveMind and I am asking stupid questions? Thank you, Virgil From userboothjason@example.com Fri Dec 07 17:47:00 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 92904 invoked from network); 7 Dec 2007 17:47:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 7 Dec 2007 17:47:00 -0000 Received: (qmail 38642 invoked by uid 500); 7 Dec 2007 17:46:48 -0000 Delivered-To: boothjason@example.com Received: (qmail 38429 invoked by uid 500); 7 Dec 2007 17:46:48 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 38420 invoked by uid 99); 7 Dec 2007 17:46:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Dec 2007 09:46:48 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [83.161.120.155] (HELO nz-out-0506.google.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Dec 2007 17:46:27 +0000 Received: by nz-out-0506.google.com with SMTP id r28so333732nza for <boothjason@example.com>; Fri, 07 Dec 2007 09:46:28 -0800 (PST) Received: by 83.161.120.155 with SMTP id o2mr2303426wff.1197049588124; Fri, 07 Dec 2007 09:46:28 -0800 (PST) Received: by 83.161.120.155 with HTTP; Fri, 7 Dec 2007 09:46:28 -0800 (PST) Message-ID: <boothjason@example.com> Date: Fri, 7 Dec 2007 12:46:28 -0500 From: "James Carman" <boothjason@example.com> Sender: boothjason@example.com To: boothjason@example.com Subject: Re: Multithreading in HiveMind In-Reply-To: <boothjason@example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <boothjason@example.com> X-Google-Sender-Auth: 56ba6f51633384a0 X-Virus-Checked: Checked by ClamAV on apache.org HiveMind doesn't create the threads. But, it will help you make sure that you aren't using instances of the service implementation across threads (by using threaded or pooled service model). On 12/7/07, Trasca Virgil <boothjason@example.com> wrote: > Hi, > > I have a question related with how is multithrreading implemented in HiveMind. I know that HiveMind tries to "take the responsibility" of instantiating threads for the IoC components. I am new to HiveMind and if what I am saying is wrong please correct me. But on the other hand how is handled the following situation. > > I am trying to integrate Quartz (http://www.opensymphony.com/quartz/) into HiveMind framework. Quartz is also trying to manage the threads by his own claiming that the performance will be better and the user will not have any headaches with complicated stuff. So HiveMind is creating threads when he thinks is necessary in the same time Quartz creates some other threads when he thinks is necessary...and maybe I will also come with some other threads that I will consider I need. Is this a real risk to get a mess or I just don't have enough knowledge about HiveMind and I am asking stupid questions? > > Thank you, > Virgil > > > From userboothjason@example.com Sun Dec 09 19:45:18 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 37276 invoked from network); 9 Dec 2007 19:45:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 9 Dec 2007 19:45:18 -0000 Received: (qmail 66503 invoked by uid 500); 9 Dec 2007 19:45:06 -0000 Delivered-To: boothjason@example.com Received: (qmail 66487 invoked by uid 500); 9 Dec 2007 19:45:06 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 66478 invoked by uid 99); 9 Dec 2007 19:45:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Dec 2007 11:45:06 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of boothjason@example.com designates 83.161.120.155 as permitted sender) Received: from [83.161.120.155] (HELO wa-out-1112.google.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Dec 2007 19:44:44 +0000 Received: by wa-out-1112.google.com with SMTP id k40so3948441wah for <boothjason@example.com>; Sun, 09 Dec 2007 11:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=EzZFWqqI6PquMHR5J2MQ0JaLBUsYMkVcoJWcaETZwns=; b=ZH+Y1wQxPNjTzVePq2NS+AAvPB7ortyxugcwkklGk1ydZ51COd/UrZWOFmaPCIzsNsO+RJGsl8+DGcXIbcmG9NsvWYofo9NUpJJthbcvB5zuKzr3AUoPDgTY1+tl4qP/WG+P677uD8o0K22tcloZONp5vH+fEy7O84nrdJ5ZWAQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=WOZCKbKDfVLNJV1RKxrLF7YNiXg7Sr30OxOCxiy2mCvDCLPuOqhCIprXDL27edbQ1sy7Z3W3zJmDkP0b9FwbydvEBTFscYZom0JNOVOVTXu7n31oZ4apbzsE5YrUfs/VXlre8hzvTS1U83Kh2ey9kxQ5Bt6bppDyk2RROTyvP8w= Received: by 83.161.120.155 with SMTP id x1mr550105wal.1197229487365; Sun, 09 Dec 2007 11:44:47 -0800 (PST) Received: by 83.161.120.155 with HTTP; Sun, 9 Dec 2007 11:44:47 -0800 (PST) Message-ID: <boothjason@example.com> Date: Sun, 9 Dec 2007 20:44:47 +0100 From: "Davor Hrg" <boothjason@example.com> To: boothjason@example.com Subject: Re: Multithreading in HiveMind In-Reply-To: <boothjason@example.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_19882_27286165.1197229487357" References: <boothjason@example.com> <boothjason@example.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_19882_27286165.1197229487357 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline It's not a very smart way of trying out things ... but here it is... I've read hivemind handles generating instacnes for each thread in the background (for threaded services of course, ... and pooled) However to feel comfortable with my code and my usage of hivemind I've created simple "tests" where I've made few threads use the same service, and generate console output to make sure i've understood the concepts correctly. Davor Hrg On Dec 7, 2007 6:46 PM, James Carman <boothjason@example.com> wrote: > HiveMind doesn't create the threads. But, it will help you make sure > that you aren't using instances of the service implementation across > threads (by using threaded or pooled service model). > > On 12/7/07, Trasca Virgil <boothjason@example.com> wrote: > > Hi, > > > > I have a question related with how is multithrreading implemented in > HiveMind. I know that HiveMind tries to "take the responsibility" of > instantiating threads for the IoC components. I am new to HiveMind and if > what I am saying is wrong please correct me. But on the other hand how is > handled the following situation. > > > > I am trying to integrate Quartz (http://www.opensymphony.com/quartz/) > into HiveMind framework. Quartz is also trying to manage the threads by his > own claiming that the performance will be better and the user will not have > any headaches with complicated stuff. So HiveMind is creating threads when > he thinks is necessary in the same time Quartz creates some other threads > when he thinks is necessary...and maybe I will also come with some other > threads that I will consider I need. Is this a real risk to get a mess or I > just don't have enough knowledge about HiveMind and I am asking stupid > questions? > > > > Thank you, > > Virgil > > > > > > > ------=_Part_19882_27286165.1197229487357 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline It&#39;s not a very smart way of trying out things ... but here it is...<br><br>I&#39;ve read hivemind handles generating instacnes for each thread<br>in the background (for threaded services of course, ... and pooled)<br> <br>However to feel comfortable with my code and my usage of hivemind<br>I&#39;ve created simple &quot;tests&quot; where I&#39;ve made few threads use the same service,<br>and generate console output to make sure i&#39;ve understood the concepts correctly. <br><br><br>Davor Hrg<br><br><br>On Dec 7, 2007 6:46 PM, James Carman &lt;<a href="mailto:boothjason@example.com">boothjason@example.com</a>&gt; wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> HiveMind doesn&#39;t create the threads. &nbsp;But, it will help you make sure<br>that you aren&#39;t using instances of the service implementation across<br>threads (by using threaded or pooled service model).<br><div><div></div> <div class="Wj3C7c"><br>On 12/7/07, Trasca Virgil &lt;<a href="mailto:boothjason@example.com">boothjason@example.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; &nbsp; &nbsp;I have a question related with how is multithrreading implemented in HiveMind. I know that HiveMind tries to &quot;take the responsibility&quot; of &nbsp;instantiating threads for the IoC components. I am new to HiveMind and if what I am saying is wrong please correct me. But on the other hand how is handled the following situation. <br>&gt;<br>&gt; I am trying to integrate Quartz (<a href="http://www.opensymphony.com/quartz/" target="_blank">http://www.opensymphony.com/quartz/</a>) into HiveMind framework. Quartz is also trying to manage the threads by his own claiming that the performance will be better and the user will not have any headaches with complicated stuff. So HiveMind is creating threads when he thinks is necessary in the same time Quartz creates some other threads when he thinks is necessary...and maybe I will also come with some other threads that I will consider I need. Is this a real risk to get a mess or I just don&#39;t have enough knowledge about HiveMind and I am asking stupid questions? <br>&gt;<br>&gt; Thank you,<br>&gt; Virgil<br>&gt;<br>&gt;<br>&gt;<br></div></div></blockquote></div><br> ------=_Part_19882_27286165.1197229487357-- From userboothjason@example.com Tue Dec 11 15:23:37 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 5762 invoked from network); 11 Dec 2007 15:23:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Dec 2007 15:23:37 -0000 Received: (qmail 63486 invoked by uid 500); 11 Dec 2007 15:23:25 -0000 Delivered-To: boothjason@example.com Received: (qmail 63480 invoked by uid 500); 11 Dec 2007 15:23:25 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 63471 invoked by uid 99); 11 Dec 2007 15:23:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 07:23:25 -0800 X-ASF-Spam-Status: No, hits=-2.6 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [83.161.120.155] (HELO XSMTP0.ethz.ch) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 15:23:24 +0000 Received: from xfe0.d.ethz.ch ([83.161.120.155]) by XSMTP0.ethz.ch with Microsoft SMTPSVC(646)582-0504); Tue, 11 Dec 2007 16:23:03 +0100 Received: from [83.161.120.155] ([83.161.120.155]) by xfe0.d.ethz.ch over TLS secured channel with Microsoft SMTPSVC(646)582-0504); Tue, 11 Dec 2007 16:23:03 +0100 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <000c01c83740$19e8c920$0301a8c0@VAIOSZ330> References: <boothjason@example.com> <000c01c83740$19e8c920$0301a8c0@VAIOSZ330> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <boothjason@example.com> Content-Transfer-Encoding: quoted-printable From: Kaspar Fischer <boothjason@example.com> Subject: Re: Using Hivemind to wrap a transaction around a request Date: Tue, 11 Dec 2007 16:22:58 +0100 To: boothjason@example.com X-Mailer: Apple Mail (2.752.3) X-OriginalArrivalTime: 11 Dec 2007 15:23:03.0103 (UTC) FILETIME=[B8B0DCF0:01C83C09] X-Virus-Checked: Checked by ClamAV on apache.org Dear Jean-Fran=E7ois, Thank you for your email. I think I get the basic idea of what you =20 are saying: Tell Hivemind to put the "begin()" and "commit()" around the relevant =20= methods of Tapestry (and make it call "rollback()" on uncaught exceptions). =20 Is this correct, so far? One first uncertainty in this is what Tapestry method I should =20 intercept? It can't be around a single page-request as redirecting, rewinding, =20 etc. won't work then. Do you happen to know what might be the right method? I've taken a look at HiveTranse and understand parts of it. However, =20 I do not know where to start -- obviously, I need to inject my own "begin()" and "commit()" as I am neither running Hibernate, not JDBC, etc. =20 directly. Could you maybe provide a few directions on how to write my HiveMind =20 interceptor? Maybe it's easier without HiveTranse first? I am sorry if my questions are very basic, and I imagine it's =20 probably boring for you. I can promise that I will post a solution to the tapestry =20 list and also extend the article I've written at the Alfresco Wiki: http://wiki.alfresco.com/wiki/=20 Alfresco_and_Tapestry_on_the_Same_Tomcat_Installation With this, you're help will hopefully not just help me but others as =20 well. Best, Kaspar On 05.12.2007, at 14:09, Jean-Francois Poilpret wrote: > Hi Kaspar, > > I think you'd rather take a look at HiveMind interceptors rather than > factories. > You can create an Interceptor that will be called before and after any > method of another service. > There are several ways to create interceptors in HiveMind, take a =20 > look at > HiveMind website to see simple examples. > > If you want to see a real-life implementation of such a system you =20 > may take > a look at hivetranse (http://hivetranse.sourceforge.net) which =20 > implements > the same kind of behavior as you are looking for. I think you could =20= > quite > easily adapt one of the numerous hivetranse interceptors (choose =20 > one -the > simples- as an example). > > Cheers > > Jean-Francois > > -----Original Message----- > From: Kaspar Fischer [mailto:boothjason@example.com] > Sent: Wednesday, December 05, 2007 7:32 PM > To: boothjason@example.com > Subject: Using Hivemind to wrap a transaction around a request > > [Note: This is a cross-post; I have initially posted to the list > boothjason@example.com but I guess the issue is more related to > hivemind, > so I post here.] > > Hi list, > > I need to wrap "begin transaction" and "end transaction" actions =20 > around > a task (a Tapestry web request, actually). I've read about Hivemind, > > http://www.nabble.com/hivemind-factory-service-=20 > tf251931.html#a704856 > > and configured a service point (see below). This works very well: my > transaction is created, but I cannot see when it is ended (committed/ > rolled back). > > More precisely, I am struggling with: > > * What method is called on the object created by the factory when it > is discarded? It is threadDidDiscardService(), right? > > * How can I catch exceptions from my actual task so that I can do a > rollback > instead of a commit? > > I am new to Hivemind, so please excuse these rather simple questions. > > Many thanks for you patience! > Kaspar > > --=20 > Here's my configuration: > > <service-point > interface=3D"org.my.tapestry.alfresco.AlfrescoTransactionContext" > id=3D"alfrescoContext"> > <invoke-factory service-id=3D"AlfrescoTransactionFactory" > model=3D"threaded" /> > </service-point> > <service-point > interface=3D"org.apache.hivemind.ServiceImplementationFactory" > id=3D"AlfrescoTransactionFactory" parameters-occurs=3D"none"> > <create-instance > class=3D"org.my.tapestry.alfresco.AlfrescoTransactionFactory" /> > </service-point> > > Here is my factory: > > public class AlfrescoTransactionFactory implements > ServiceImplementationFactory, Discardable { > > public Object createCoreServiceImplementation > (ServiceImplementationFactoryParameters factoryParameters) > { > System.err.println("createCoreServiceImplementation"); // gets > called! > UserTransaction transaction; > ServiceRegistry serviceRegistry; > try { > transaction =3D > AlfrescoApplicationInitializer.createAndBeginAuthenticatedTransaction > (true); > serviceRegistry =3D > AlfrescoApplicationInitializer.getServiceRegistry(); > } > catch (Exception e) { > throw new ApplicationRuntimeException("Could not create an > Alfresco transactoin.", e); > } > return new AlfrescoTransactionContextImpl(transaction, > serviceRegistry); > } > > public void threadDidDiscardService() > { > System.err.println("threadDidDiscardService"); // never called! > // ... end the transaction here (todo) > } > } > From userboothjason@example.com Tue Dec 11 17:40:03 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 74310 invoked from network); 11 Dec 2007 17:40:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Dec 2007 17:40:03 -0000 Received: (qmail 6593 invoked by uid 500); 11 Dec 2007 17:39:51 -0000 Delivered-To: boothjason@example.com Received: (qmail 6582 invoked by uid 500); 11 Dec 2007 17:39:51 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 6573 invoked by uid 99); 11 Dec 2007 17:39:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 09:39:51 -0800 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of boothjason@example.com designates 83.161.120.155 as permitted sender) Received: from [83.161.120.155] (HELO ug-out-1314.google.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 17:39:27 +0000 Received: by ug-out-1314.google.com with SMTP id j3so338887ugf.49 for <boothjason@example.com>; Tue, 11 Dec 2007 09:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; bh=2R+h3D7lU3LgyN7d5EORJG4yXZ9IyI35vbH2skREkds=; b=XUcZcGBIbpnE94f0IZBZw3TkIwP0O4cSb7NZzeoHsXm/gZ3ZKL775ED9K6/4Rd+iKLaA1NeK+RdMnV5l1qkHa7QBFkBctIUB97Vbmidhc6AKkXJicN65n9hnr+UdeAam5q7cgq2OqWoFn4M451mnRjFHLOpZSONi4kTMObER8kA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=sGO0NujkUVCY7h7z1PoORi8TedzLpJFIJK0S0nZXuZoNbvea1XaiFqW9IDDFMsThKKtECbroiDlK4kbal86ODGMpXUWRdDVi/vmXKU9NMTqbNdeuOKFN+m/kGafRmi7hC/K9IXpAtO/B3OKu0k2CWt36IpQFyVNZBQMZU/3l/3o= Received: by 83.161.120.155 with SMTP id v18mr5289019fgb.1197394769151; Tue, 11 Dec 2007 09:39:29 -0800 (PST) Received: from ?83.161.120.155? ( [83.161.120.155]) by mx.google.com with ESMTPS id e11sm3324487fga.283.161.120.155.39.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 11 Dec 2007 09:39:27 -0800 (PST) Message-ID: <boothjason@example.com> Date: Tue, 11 Dec 2007 19:41:02 +0100 From: Alebu <boothjason@example.com> User-Agent: Thunderbird 83.161.120.155 (Windows/20071031) MIME-Version: 1.0 To: boothjason@example.com Subject: Re: Using Hivemind to wrap a transaction around a request References: <boothjason@example.com> <000c01c83740$19e8c920$0301a8c0@VAIOSZ330> <boothjason@example.com> In-Reply-To: <boothjason@example.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Kaspar, There is a tutorial on TSS about Hivemind by James Carman. http://www.theserverside.com/tt/articles/article.tss?l=HivemindBuzz And as example of interceptor there is a TransactionInterceptor. Perhaps it can help you to start your own solution. And dont be shy to ask help in mailing list. Hivemind is a great product but lack of documentation is most is thing about it, so others people help is very important. Kaspar Fischer wrote: > Dear Jean-François, > > Thank you for your email. I think I get the basic idea of what you are > saying: > Tell Hivemind to put the "begin()" and "commit()" around the relevant > methods > of Tapestry (and make it call "rollback()" on uncaught exceptions). Is > this > correct, so far? > > One first uncertainty in this is what Tapestry method I should intercept? > It can't be around a single page-request as redirecting, rewinding, > etc. won't > work then. Do you happen to know what might be the right method? > > I've taken a look at HiveTranse and understand parts of it. However, I do > not know where to start -- obviously, I need to inject my own "begin()" > and "commit()" as I am neither running Hibernate, not JDBC, etc. > directly. > > Could you maybe provide a few directions on how to write my HiveMind > interceptor? > Maybe it's easier without HiveTranse first? > > I am sorry if my questions are very basic, and I imagine it's probably > boring > for you. I can promise that I will post a solution to the tapestry > list and > also extend the article I've written at the Alfresco Wiki: > > > http://wiki.alfresco.com/wiki/Alfresco_and_Tapestry_on_the_Same_Tomcat_Installation > > > With this, you're help will hopefully not just help me but others as > well. > > Best, > Kaspar > > On 05.12.2007, at 14:09, Jean-Francois Poilpret wrote: > >> Hi Kaspar, >> >> I think you'd rather take a look at HiveMind interceptors rather than >> factories. >> You can create an Interceptor that will be called before and after any >> method of another service. >> There are several ways to create interceptors in HiveMind, take a >> look at >> HiveMind website to see simple examples. >> >> If you want to see a real-life implementation of such a system you >> may take >> a look at hivetranse (http://hivetranse.sourceforge.net) which >> implements >> the same kind of behavior as you are looking for. I think you could >> quite >> easily adapt one of the numerous hivetranse interceptors (choose one >> -the >> simples- as an example). >> >> Cheers >> >> Jean-Francois >> >> -----Original Message----- >> From: Kaspar Fischer [mailto:boothjason@example.com] >> Sent: Wednesday, December 05, 2007 7:32 PM >> To: boothjason@example.com >> Subject: Using Hivemind to wrap a transaction around a request >> >> [Note: This is a cross-post; I have initially posted to the list >> boothjason@example.com but I guess the issue is more related to >> hivemind, >> so I post here.] >> >> Hi list, >> >> I need to wrap "begin transaction" and "end transaction" actions around >> a task (a Tapestry web request, actually). I've read about Hivemind, >> >> http://www.nabble.com/hivemind-factory-service-tf251931.html#a704856 >> >> and configured a service point (see below). This works very well: my >> transaction is created, but I cannot see when it is ended (committed/ >> rolled back). >> >> More precisely, I am struggling with: >> >> * What method is called on the object created by the factory when it >> is discarded? It is threadDidDiscardService(), right? >> >> * How can I catch exceptions from my actual task so that I can do a >> rollback >> instead of a commit? >> >> I am new to Hivemind, so please excuse these rather simple questions. >> >> Many thanks for you patience! >> Kaspar >> >> -- >> Here's my configuration: >> >> <service-point >> interface="org.my.tapestry.alfresco.AlfrescoTransactionContext" >> id="alfrescoContext"> >> <invoke-factory service-id="AlfrescoTransactionFactory" >> model="threaded" /> >> </service-point> >> <service-point >> interface="org.apache.hivemind.ServiceImplementationFactory" >> id="AlfrescoTransactionFactory" parameters-occurs="none"> >> <create-instance >> class="org.my.tapestry.alfresco.AlfrescoTransactionFactory" /> >> </service-point> >> >> Here is my factory: >> >> public class AlfrescoTransactionFactory implements >> ServiceImplementationFactory, Discardable { >> >> public Object createCoreServiceImplementation >> (ServiceImplementationFactoryParameters factoryParameters) >> { >> System.err.println("createCoreServiceImplementation"); // gets >> called! >> UserTransaction transaction; >> ServiceRegistry serviceRegistry; >> try { >> transaction = >> AlfrescoApplicationInitializer.createAndBeginAuthenticatedTransaction >> (true); >> serviceRegistry = >> AlfrescoApplicationInitializer.getServiceRegistry(); >> } >> catch (Exception e) { >> throw new ApplicationRuntimeException("Could not create an >> Alfresco transactoin.", e); >> } >> return new AlfrescoTransactionContextImpl(transaction, >> serviceRegistry); >> } >> >> public void threadDidDiscardService() >> { >> System.err.println("threadDidDiscardService"); // never called! >> // ... end the transaction here (todo) >> } >> } >> > > From userboothjason@example.com Tue Dec 11 18:29:34 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 64924 invoked from network); 11 Dec 2007 18:29:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Dec 2007 18:29:34 -0000 Received: (qmail 84813 invoked by uid 500); 11 Dec 2007 18:29:22 -0000 Delivered-To: boothjason@example.com Received: (qmail 84802 invoked by uid 500); 11 Dec 2007 18:29:22 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 84793 invoked by uid 99); 11 Dec 2007 18:29:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 10:29:22 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [83.161.120.155] (HELO py-out-1112.google.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 18:28:58 +0000 Received: by py-out-1112.google.com with SMTP id u77so12173pyb for <boothjason@example.com>; Tue, 11 Dec 2007 10:28:57 -0800 (PST) Received: by 83.161.120.155 with SMTP id o2mr3815551wff.1197397735072; Tue, 11 Dec 2007 10:28:55 -0800 (PST) Received: by 83.161.120.155 with HTTP; Tue, 11 Dec 2007 10:28:55 -0800 (PST) Message-ID: <boothjason@example.com> Date: Tue, 11 Dec 2007 13:28:55 -0500 From: "James Carman" <boothjason@example.com> Sender: boothjason@example.com To: boothjason@example.com Subject: Re: Using Hivemind to wrap a transaction around a request In-Reply-To: <boothjason@example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <boothjason@example.com> <000c01c83740$19e8c920$0301a8c0@VAIOSZ330> <boothjason@example.com> <boothjason@example.com> X-Google-Sender-Auth: 44ebd18699222c40 X-Virus-Checked: Checked by ClamAV on apache.org You might also want to take a look at some of the HiveMind-based boothjason@example.com. In particular, look at: http://svn.javaforge.com/svn/hivemind/hivemind-transaction http://svn.javaforge.com/svn/hivemind/hivemind-hibernate3 Those two projects basically set up the Spring transaction/hibernate support for you in HiveMind. I wrote those two projects after my article. On 12/11/07, Alebu <boothjason@example.com> wrote: > Hi Kaspar, > There is a tutorial on TSS about Hivemind by James Carman. > http://www.theserverside.com/tt/articles/article.tss?l=3DHivemindBuzz > And as example of interceptor there is a TransactionInterceptor. > Perhaps it can help you to start your own solution. > And dont be shy to ask help in mailing list. Hivemind is a great product > but lack of > documentation is most is thing about it, so others people help is very > important. > > Kaspar Fischer wrote: > > Dear Jean-Fran=E7ois, > > > > Thank you for your email. I think I get the basic idea of what you are > > saying: > > Tell Hivemind to put the "begin()" and "commit()" around the relevant > > methods > > of Tapestry (and make it call "rollback()" on uncaught exceptions). Is > > this > > correct, so far? > > > > One first uncertainty in this is what Tapestry method I should intercep= t? > > It can't be around a single page-request as redirecting, rewinding, > > etc. won't > > work then. Do you happen to know what might be the right method? > > > > I've taken a look at HiveTranse and understand parts of it. However, I = do > > not know where to start -- obviously, I need to inject my own "begin()" > > and "commit()" as I am neither running Hibernate, not JDBC, etc. > > directly. > > > > Could you maybe provide a few directions on how to write my HiveMind > > interceptor? > > Maybe it's easier without HiveTranse first? > > > > I am sorry if my questions are very basic, and I imagine it's probably > > boring > > for you. I can promise that I will post a solution to the tapestry > > list and > > also extend the article I've written at the Alfresco Wiki: > > > > > > http://wiki.alfresco.com/wiki/Alfresco_and_Tapestry_on_the_Same_Tomcat_= Installation > > > > > > With this, you're help will hopefully not just help me but others as > > well. > > > > Best, > > Kaspar > > > > On 05.12.2007, at 14:09, Jean-Francois Poilpret wrote: > > > >> Hi Kaspar, > >> > >> I think you'd rather take a look at HiveMind interceptors rather than > >> factories. > >> You can create an Interceptor that will be called before and after any > >> method of another service. > >> There are several ways to create interceptors in HiveMind, take a > >> look at > >> HiveMind website to see simple examples. > >> > >> If you want to see a real-life implementation of such a system you > >> may take > >> a look at hivetranse (http://hivetranse.sourceforge.net) which > >> implements > >> the same kind of behavior as you are looking for. I think you could > >> quite > >> easily adapt one of the numerous hivetranse interceptors (choose one > >> -the > >> simples- as an example). > >> > >> Cheers > >> > >> Jean-Francois > >> > >> -----Original Message----- > >> From: Kaspar Fischer [mailto:boothjason@example.com] > >> Sent: Wednesday, December 05, 2007 7:32 PM > >> To: boothjason@example.com > >> Subject: Using Hivemind to wrap a transaction around a request > >> > >> [Note: This is a cross-post; I have initially posted to the list > >> boothjason@example.com but I guess the issue is more related to > >> hivemind, > >> so I post here.] > >> > >> Hi list, > >> > >> I need to wrap "begin transaction" and "end transaction" actions aroun= d > >> a task (a Tapestry web request, actually). I've read about Hivemind, > >> > >> http://www.nabble.com/hivemind-factory-service-tf251931.html#a70485= 6 > >> > >> and configured a service point (see below). This works very well: my > >> transaction is created, but I cannot see when it is ended (committed/ > >> rolled back). > >> > >> More precisely, I am struggling with: > >> > >> * What method is called on the object created by the factory when it > >> is discarded? It is threadDidDiscardService(), right? > >> > >> * How can I catch exceptions from my actual task so that I can do a > >> rollback > >> instead of a commit? > >> > >> I am new to Hivemind, so please excuse these rather simple questions. > >> > >> Many thanks for you patience! > >> Kaspar > >> > >> -- > >> Here's my configuration: > >> > >> <service-point > >> interface=3D"org.my.tapestry.alfresco.AlfrescoTransactionContext" > >> id=3D"alfrescoContext"> > >> <invoke-factory service-id=3D"AlfrescoTransactionFactory" > >> model=3D"threaded" /> > >> </service-point> > >> <service-point > >> interface=3D"org.apache.hivemind.ServiceImplementationFactory" > >> id=3D"AlfrescoTransactionFactory" parameters-occurs=3D"none"> > >> <create-instance > >> class=3D"org.my.tapestry.alfresco.AlfrescoTransactionFactory" /> > >> </service-point> > >> > >> Here is my factory: > >> > >> public class AlfrescoTransactionFactory implements > >> ServiceImplementationFactory, Discardable { > >> > >> public Object createCoreServiceImplementation > >> (ServiceImplementationFactoryParameters factoryParameters) > >> { > >> System.err.println("createCoreServiceImplementation"); // gets > >> called! > >> UserTransaction transaction; > >> ServiceRegistry serviceRegistry; > >> try { > >> transaction =3D > >> AlfrescoApplicationInitializer.createAndBeginAuthenticatedTransaction > >> (true); > >> serviceRegistry =3D > >> AlfrescoApplicationInitializer.getServiceRegistry(); > >> } > >> catch (Exception e) { > >> throw new ApplicationRuntimeException("Could not create an > >> Alfresco transactoin.", e); > >> } > >> return new AlfrescoTransactionContextImpl(transaction, > >> serviceRegistry); > >> } > >> > >> public void threadDidDiscardService() > >> { > >> System.err.println("threadDidDiscardService"); // never called! > >> // ... end the transaction here (todo) > >> } > >> } > >> > > > > > > From userboothjason@example.com Tue Dec 11 18:30:35 2007 Return-Path: <userboothjason@example.com> Delivered-To: boothjason@example.com Received: (qmail 66147 invoked from network); 11 Dec 2007 18:30:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Dec 2007 18:30:35 -0000 Received: (qmail 85841 invoked by uid 500); 11 Dec 2007 18:30:24 -0000 Delivered-To: boothjason@example.com Received: (qmail 85831 invoked by uid 500); 11 Dec 2007 18:30:24 -0000 Mailing-List: contact boothjason@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:boothjason@example.com> List-Unsubscribe: <mailto:boothjason@example.com> List-Post: <mailto:boothjason@example.com> List-Id: <user.hivemind.apache.org> Reply-To: boothjason@example.com Delivered-To: mailing list boothjason@example.com Received: (qmail 85822 invoked by uid 99); 11 Dec 2007 18:30:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 10:30:23 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [83.161.120.155] (HELO wr-out-0506.google.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 18:30:00 +0000 Received: by wr-out-0506.google.com with SMTP id c38so1774938wra for <boothjason@example.com>; Tue, 11 Dec 2007 10:29:24 -0800 (PST) Received: by 83.161.120.155 with SMTP id n9mr2179152wfh.1197397761103; Tue, 11 Dec 2007 10:29:21 -0800 (PST) Received: by 83.161.120.155 with HTTP; Tue, 11 Dec 2007 10:29:21 -0800 (PST) Message-ID: <boothjason@example.com> Date: Tue, 11 Dec 2007 13:29:21 -0500 From: "James Carman" <boothjason@example.com> Sender: boothjason@example.com To: boothjason@example.com Subject: Re: Using Hivemind to wrap a transaction around a request In-Reply-To: <boothjason@example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <boothjason@example.com> <000c01c83740$19e8c920$0301a8c0@VAIOSZ330> <boothjason@example.com> <boothjason@example.com> <boothjason@example.com> X-Google-Sender-Auth: 67ebbef0e044a565 X-Virus-Checked: Checked by ClamAV on apache.org By the way, you can login using anonymous/anon. On 12/11/07, James Carman <boothjason@example.com> wrote: > You might also want to take a look at some of the HiveMind-based > boothjason@example.com. In particular, look at: > > http://svn.javaforge.com/svn/hivemind/hivemind-transaction > http://svn.javaforge.com/svn/hivemind/hivemind-hibernate3 > > Those two projects basically set up the Spring transaction/hibernate > support for you in HiveMind. I wrote those two projects after my > article. > > On 12/11/07, Alebu <boothjason@example.com> wrote: > > Hi Kaspar, > > There is a tutorial on TSS about Hivemind by James Carman. > > http://www.theserverside.com/tt/articles/article.tss?l=3DHivemindBuzz > > And as example of interceptor there is a TransactionInterceptor. > > Perhaps it can help you to start your own solution. > > And dont be shy to ask help in mailing list. Hivemind is a great produc= t > > but lack of > > documentation is most is thing about it, so others people help is very > > important. > > > > Kaspar Fischer wrote: > > > Dear Jean-Fran=E7ois, > > > > > > Thank you for your email. I think I get the basic idea of what you ar= e > > > saying: > > > Tell Hivemind to put the "begin()" and "commit()" around the relevant > > > methods > > > of Tapestry (and make it call "rollback()" on uncaught exceptions). I= s > > > this > > > correct, so far? > > > > > > One first uncertainty in this is what Tapestry method I should interc= ept? > > > It can't be around a single page-request as redirecting, rewinding, > > > etc. won't > > > work then. Do you happen to know what might be the right method? > > > > > > I've taken a look at HiveTranse and understand parts of it. However, = I do > > > not know where to start -- obviously, I need to inject my own "begin(= )" > > > and "commit()" as I am neither running Hibernate, not JDBC, etc. > > > directly. > > > > > > Could you maybe provide a few directions on how to write my HiveMind > > > interceptor? > > > Maybe it's easier without HiveTranse first? > > > > > > I am sorry if my questions are very basic, and I imagine it's probabl= y > > > boring > > > for you. I can promise that I will post a solution to the tapestry > > > list and > > > also extend the article I've written at the Alfresco Wiki: > > > > > > > > > http://wiki.alfresco.com/wiki/Alfresco_and_Tapestry_on_the_Same_Tomca= t_Installation > > > > > > > > > With this, you're help will hopefully not just help me but others as > > > well. > > > > > > Best, > > > Kaspar > > > > > > On 05.12.2007, at 14:09, Jean-Francois Poilpret wrote: > > > > > >> Hi Kaspar, > > >> > > >> I think you'd rather take a look at HiveMind interceptors rather tha= n > > >> factories. > > >> You can create an Interceptor that will be called before and after a= ny > > >> method of another service. > > >> There are several ways to create interceptors in HiveMind, take a > > >> look at > > >> HiveMind website to see simple examples. > > >> > > >> If you want to see a real-life implementation of such a system you > > >> may take > > >> a look at hivetranse (http://hivetranse.sourceforge.net) which > > >> implements > > >> the same kind of behavior as you are looking for. I think you could > > >> quite > > >> easily adapt one of the numerous hivetranse interceptors (choose one > > >> -the > > >> simples- as an example). > > >> > > >> Cheers > > >> > > >> Jean-Francois > > >> > > >> -----Original Message----- > > >> From: Kaspar Fischer [mailto:boothjason@example.com] > > >> Sent: Wednesday, December 05, 2007 7:32 PM > > >> To: boothjason@example.com > > >> Subject: Using Hivemind to wrap a transaction around a request > > >> > > >> [Note: This is a cross-post; I have initially posted to the list > > >> boothjason@example.com but I guess the issue is more related to > > >> hivemind, > > >> so I post here.] > > >> > > >> Hi list, > > >> > > >> I need to wrap "begin transaction" and "end transaction" actions aro= und > > >> a task (a Tapestry web request, actually). I've read about Hivemind, > > >> > > >> http://www.nabble.com/hivemind-factory-service-tf251931.html#a704= 856 > > >> > > >> and configured a service point (see below). This works very well: my > > >> transaction is created, but I cannot see when it is ended (committed= / > > >> rolled back). > > >> > > >> More precisely, I am struggling with: > > >> > > >> * What method is called on the object created by the factory when it > > >> is discarded? It is threadDidDiscardService(), right? > > >> > > >> * How can I catch exceptions from my actual task so that I can do a > > >> rollback > > >> instead of a commit? > > >> > > >> I am new to Hivemind, so please excuse these rather simple questions= . > > >> > > >> Many thanks for you patience! > > >> Kaspar > > >> > > >> -- > > >> Here's my configuration: > > >> > > >> <service-point > > >> interface=3D"org.my.tapestry.alfresco.AlfrescoTransactionContext" > > >> id=3D"alfrescoContext"> > > >> <invoke-factory service-id=3D"AlfrescoTransactionFactory" > > >> model=3D"threaded" /> > > >> </service-point> > > >> <service-point > > >> interface=3D"org.apache.hivemind.ServiceImplementationFactory" > > >> id=3D"AlfrescoTransactionFactory" parameters-occurs=3D"none"> > > >> <create-instance > > >> class=3D"org.my.tapestry.alfresco.AlfrescoTransactionFactory" /> > > >> </service-point> > > >> > > >> Here is my factory: > > >> > > >> public class AlfrescoTransactionFactory implements > > >> ServiceImplementationFactory, Discardable { > > >> > > >> public Object createCoreServiceImplementation > > >> (ServiceImplementationFactoryParameters factoryParameters) > > >> { > > >> System.err.println("createCoreServiceImplementation"); // gets > > >> called! > > >> UserTransaction
{'source': 'Apache Software Foundation Public Mail Archives'}