Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 59689 invoked from network); 21 Jun 2005 14:45:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jun 2005 14:45:48 -0000 Received: (qmail 20509 invoked by uid 500); 21 Jun 2005 14:45:47 -0000 Mailing-List: contact jackrabbit-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-dev@incubator.apache.org Received: (qmail 20494 invoked by uid 99); 21 Jun 2005 14:45:47 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jun 2005 07:45:47 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [212.249.34.130] (HELO picanmix.dev.day.com) (212.249.34.130) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jun 2005 07:45:48 -0700 Received: from eu-mail.day.com (eu-mail.dev.day.com [10.0.0.30]) by picanmix.dev.day.com (DAY) with ESMTP id j5LEji523585 for ; Tue, 21 Jun 2005 16:45:44 +0200 (MEST) Received: from [127.0.0.1] ([10.0.0.67]) by eu-mail.day.com (Lotus Domino Release 5.0.8) with ESMTP id 2005062116454231:23382 ; Tue, 21 Jun 2005 16:45:42 +0200 Message-ID: <42B827BC.10701@day.com> Date: Tue, 21 Jun 2005 16:44:12 +0200 From: Felix Meschberger Organization: Day Software User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: jackrabbit-dev@incubator.apache.org Subject: Re: ObservationManager for JCR-RMI References: <42B7CD44.3070700@day.com> <42B7EFA3.8050300@yukatan.fi> <42B806CA.1030502@day.com> <42B81F1D.7070309@zitting.name> <42B821B2.6050300@day.com> <42B8253F.5010105@zitting.name> In-Reply-To: <42B8253F.5010105@zitting.name> X-MIMETrack: Itemize by SMTP Server on eu-mail/Day(Release 5.0.8 |June 18, 2001) at 06/21/2005 04:45:42 PM, Serialize by Router on eu-mail/Day(Release 5.0.8 |June 18, 2001) at 06/21/2005 04:45:43 PM, Serialize complete at 06/21/2005 04:45:43 PM Content-Type: multipart/mixed; boundary="------------020406020306050902010000" X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------020406020306050902010000 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-15; format=flowed Hi, Hehe - those dreaded fingers are always faster than my mind .... Next try. Hope this now makes it. Sorry for the overhead. Regards Felix Jukka Zitting schrieb: > Hi, > > Sorry to bug you, almost there... :-) > > Felix Meschberger wrote: > >> * This software is the confidential and proprietary information of >> * Day Management AG, ("Confidential Information"). You shall not >> * disclose such Confidential Information and shall use it only in >> * accordance with the terms of the license agreement you entered into >> * with Day. > > > BR, > > Jukka Zitting > --------------020406020306050902010000 Content-Transfer-Encoding: 7bit Content-Type: text/plain; name="Queue.java" Content-Disposition: inline; filename="Queue.java" /* * Copyright 2004-2005 The Apache Software Foundation or its licensors, * as applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jackrabbit.rmi.observation; import java.util.LinkedList; /** * The Queue class is a very simple queue assuming that there is * at least one consumer and potentially multiple producers. This class poses * no restrictions on the size of the queue. * * @author Felix Meschberger */ public class Queue { /** The linked list implementing the queue of data */ private final LinkedList queue; /** * Creates an instance of this queue. */ public Queue() { queue = new LinkedList(); } /** * Appends the given object to the end of the queue. *

* After appending the element, the queue is notified such that threads * waiting to retrieve an element from the queue are woken up. */ public void put(Object object) { synchronized (queue) { queue.addLast(object); queue.notifyAll(); } } /** * Returns the first element from the queue. If the queue is currently empty * the method waits at most the given number of milliseconds. * * @param timeout The maximum number of milliseconds to wait for an entry in * the queue if the queue is empty. If zero, the method waits forever * for an element. * * @return The first element of the queue or null if the method * timed out waiting for an entry. * * @throws InterruptedException Is thrown if the current thread is * interrupted while waiting for the queue to get at least one entry. */ public Object get(long timeout) throws InterruptedException { synchronized (queue) { // wait for data if the queue is empty if (queue.isEmpty()) { queue.wait(timeout); } // return null if queue is (still) empty if (queue.isEmpty()) { return null; } // return first if queue has content now return queue.removeFirst(); } } } --------------020406020306050902010000--