1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 <2010> 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 <2010> 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: CAJ bug? |
From: | "Carcassi, Gabriele" <[email protected]> |
To: | <[email protected]> |
Date: | Fri, 19 Feb 2010 16:21:25 -0500 |
It seems that I need a ctxt.flushIo()
after creating the monitor (thanks Geoff!). Can we add this to the JavaDocs?
* Adds a monitor to
this Channel. The monitor is guaranteed to start working * only after the
next call to {@link #flushIo()}. * ... Thanks! Gabriele From:
[email protected] [mailto:[email protected]] On
Behalf Of Carcassi, Gabriele Hi all, I have found something that looks like a bug in CAJ. If
monitors are not registered right after the creation of the Channel, they
don’t get notified at all. Here is a test case: public class CAJBugTest { public static void main(String[] args)
throws Exception { JCALibrary jca =
JCALibrary.getInstance(); Context ctxt =
jca.createContext(JCALibrary.CHANNEL_ACCESS_JAVA); Channel ch =
ctxt.createChannel("pvk01");
//ctxt.pendIO(1.0);
//Thread.sleep(1000);
ch.addMonitor(DBRType.DOUBLE, 1, Monitor.VALUE, new MonitorListener() {
@Override
public void monitorChanged(MonitorEvent ev) {
System.out.println("1 -> " + ev.getDBR().getValue());
} });
//Thread.sleep(1000); Channel ch2 =
ctxt.createChannel("pvk01");
ch2.addMonitor(DBRType.DOUBLE, 1, Monitor.VALUE, new MonitorListener() {
@Override
public void monitorChanged(MonitorEvent ev) {
System.out.println("2 -> " + ev.getDBR().getValue());
} });
Thread.sleep(5000); ch.destroy(); ch2.destroy(); ctxt.destroy(); } } With the comments, this will work and show updates for the
first and the second monitor. If the Sleep or pendIO calls are uncommented, all
the subsequent monitor are not being notified. So, for example, if you remove
the second sleep, you would see the notifications for the first monitor but not
the second. The problem is that this more or less defies the purpose of
having CAJ caching and managing the channels and monitors for me… :-/ I am using CAJ 1.1.5b, JCA 2.3.2 on a Windows machine. Any
thoughts? Gabriele |