commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Eckenfels (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (VFS-504) Duplicate notifications if there are multiple subscription to same file
Date Sun, 18 May 2014 00:21:14 GMT

     [ 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)

Mime
View raw message