Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C85AB11E99 for ; Sun, 18 May 2014 00:50:23 +0000 (UTC) Received: (qmail 98261 invoked by uid 500); 18 May 2014 00:25:22 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 96973 invoked by uid 500); 18 May 2014 00:25:21 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 95977 invoked by uid 99); 18 May 2014 00:21:14 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 May 2014 00:21:14 +0000 Date: Sun, 18 May 2014 00:21:14 +0000 (UTC) From: "Bernd Eckenfels (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (VFS-504) Duplicate notifications if there are multiple subscription to same file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/VFS-504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bernd Eckenfels updated VFS-504: -------------------------------- Priority: Minor (was: Critical) > Duplicate notifications if there are multiple subscription to same file > ----------------------------------------------------------------------- > > Key: VFS-504 > URL: https://issues.apache.org/jira/browse/VFS-504 > Project: Commons VFS > Issue Type: Bug > Affects Versions: 2.0 > Reporter: Scott.Wu > Priority: Minor > > I initiate 2 threads to monitor same file. I hope to get 2 notifications if I changed file, but finally I got 4. I think the root cause is the listener is bound to file object, but event will be fired by filemonitor, each monitor will point to same file which have 2 listeners. > // main process > for (int i = 0; i < 2; i++) { > Thread thread = new Thread(new Runnable() { > public void run() { > try { > IPAdapterFileMonitor monitor = IPAdapterFileMonitor.getInstance(); > monitor.startMonitor(); > } catch (FileSystemException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > }); > thread.start(); > } > //method in thread. > public void startMonitor() throws FileSystemException{ > DefaultFileMonitor fm = new DefaultFileMonitor(new IPAdapterFileListener()); > fm.addFile(targetFile); > fm.start(); > System.out.println(Thread.currentThread().getId()); > } -- This message was sent by Atlassian JIRA (v6.2#6252)