channelaccess / ca Goto Github PK
View Code? Open in Web Editor NEWJava Channel Access Client Implementation
License: GNU General Public License v3.0
Java Channel Access Client Implementation
License: GNU General Public License v3.0
This tracker is to migrate the CA library implementation towards a more flexible, more configurable Monitor Notification solution that satisfies our current needs at PSI and hopefully those of our external users.
Let's first establish the requirements that any MonitorNotificationServiceImpl must satisfy. These were first stated in a comment on this earlier tracker. Following feedback from Simon and Fabian (thanks guys :-) ) I would now restate them as follows:
For synchronous functions like get(), put(), connect() there should probably a default timeout instead of blocking forever.
This timeout should be configureable via context properties, I guess ...
Besides the current base methods to create channels I guess there should be some convenience method to bulk create channels. This method should accept a list/set/map of channels and create and connect all of these.
We could somehow adopt the way jcae does it right now, i.e. via ChannelDescriptor (this current solution however needs to be revised somehow though).
If we go that route (channel descriptor), eventually we change the base methods as well to accept a channel descriptor ... - however then we have to distinguish the methods that automatically connect the channels and which do not ...
Under "certain circumstances" (Simon Ebner encountered it with the PSI snapshot application) the CA library emits "nasty messages" to the console. (I deliberately state this ticket in vague terms because currently the ticket is just a placeholder which requires more substantiation...)
This tracker is to investigate and where necessary make a fix.
When specifying a unicast address in the address list properties the channel will not be found.(It works if specifying the broadcast address)
This is the test code I used (the channel ARIDI-PCT:CURRENT is on the machine 129.129.130.20 ):
public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException {
Properties properties = new Properties();
properties.setProperty(Constants.ADDR_LIST_KEY, "129.129.130.20");
// properties.setProperty(Constants.ADDR_LIST_KEY, "129.129.130.255"); // this works
try (Context context = new Context(properties))
{
Channel<Double> channel = context.createChannel("ARIDI-PCT:CURRENT", Double.class);
channel.connectAsync().get(1, TimeUnit.SECONDS);
System.out.println(channel.getProperties());
System.out.println(channel.get());
channel.close();
}
}
while working with the ca library I got the feeling it might be good to add some more convenience functions the Channel interface.
The methods I think of are:
waitFor(T value);
waitFor(T value, Comparator comparator);
CompletableFuture f = waitForAsync(T value);
CompletableFuture f = waitForAsync(T value, Comparator comparator);
Regarding the names of the function I am not sure whether to just use waitFor or waitForValue .
“Within" these functions what I would do is, attaching a monitor, waiting on the value and then detaching the monitor ...
What do you think of this?
Would this make sense?
Opens the path to more efficient implementations
This was reported by one of PSI's beamline scientists when working with the MATLAB wrapper to CA.
Here is the fault report:
The problem seems that the Matlab channel access client has problem to communicate with an EPICS7 IOC on sf-ecmc-04.psi.ch
Sometimes Franziskas script just works but sometimes it just hangs when opening the connection to the IOC
What can be seen on the IOC and what we see on the client side is that there is a message that the client version is too old.
On the IOC shell:
sf-ecmc-04> CAS: request from 129.129.145.206:54086 => CAS: Client version too old
CAS: Request from 129.129.145.206:54086 => cmmd=23 cid=0x0 type=0 count=0 postsize=0
CAS: Request from 129.129.145.206:54086 => available=0x0 N=0 paddr=0x7f66c800d968On the client side - if the connection is established and the caget works:
Jan 30, 2020 10:17:05 AM org.epics.ca.impl.ResponseHandlers exceptionResponse
WARNING: Exception message reported, code: DEFUNCT, message: 'CAS: Client version 0 too old'.
The goal would be to see whether we can come up with a Disruptor solution that is both more performant than a standard Java Blocking Queue based approach and yet which doesn't use one thread per consumer. The Disruptor Polling feature probably provides the key to this, although documentation is rather ppor on this feature.
Class/Object that holds cached value that gets updated by a monitor ...
(create this object e.g. via the Channels utility class ...)
Some special units of channels are not retrieved correctly.
For example micro (µ) ends up in char 65533 (�)
Merge the external AlarmSeverity and AlarmStatus enumerations into the Alarm class so that they can be referred to as: Alarm.AlarmStatus
I guess this is more clean and simpler
Use of the .org site is now discouraged so transitioning to the new .com one.
The current implementation of the CA channel monitoring feature has a "scalability bottleneck" in that every monitor creates a separate thread to deal with notification. This imposes an upper limit on the number of monitors that can be created in the client library. On my system (MacBook Pro) the upper limit is around 4000.
This task is to investigate the issue and come up with a modified implementation where this limitation does not exist.
The file Readme.md
contains the following item in the Features section:
Support of all listeners ChannelAccess supports: ConnectionListener, AccessRightListener, Value Listener (Monitor)
It's unclear to me what that means. Is it saying that it supports similar listening to what can be done in a JCA implementation?
JCA contains the interfaces ConnectionListener
, AccessRightsListener
, and MonitorListener
(among others). If that's what this is referring to, then perhaps the item should read as follows:
Supports listening to all Channel Access events that can be listened to with a JCA implementation (e.g., similar to JCA's ConnectionListener
, AccessRightListener
, MonitorListener
, etc.)
Add an option to the addMonitor function of a channel to specify the maximum update rate of a monitor.
The use of TAB character mixed with spaces makes it difficult/impossible to view the source code in a consistent way on multiple platforms.
This task is to do a one shot change on all source files to eliminate TAB and to replace it with three spaces.
Have a flag to tell that a channel should cache values on the client side and if get() is called only the cached value get returned to the calling code.
... internally the channel would just automatically setup a value monitor and cache the returned values in a variable...
This functionality we could provide either within the current channel implementation or with a wrapper class (e.g MonitoredChannel(channel)) which has the same signature than a channel ...
This provides the possibility to reduce the visibility of certain methods in the project.
Add statement on CA version compatibility. Add section for documents.
When trying to get more metadata to the value with an generic channel the library fails
Channel<Double> channel = context.createChannel("ARIDI-PCT:CURRENT", Double.class);
channel.connectAsync().get(1, TimeUnit.SECONDS);
System.out.println(channel.get(Timestamped.class));
The exception thrown is:
Exception in thread "main" java.lang.RuntimeException: Failed to do get.
at org.epics.ca.impl.ChannelImpl.get(ChannelImpl.java:332)
at org.epics.ca.test.TE.main(TE.java:24)
Caused by: java.lang.RuntimeException: unsupported channel metadata type class org.epics.ca.data.Timestamped<class java.lang.Object>
at org.epics.ca.impl.ChannelImpl.getAsync(ChannelImpl.java:346)
at org.epics.ca.impl.ChannelImpl.get(ChannelImpl.java:330)
... 1 more
Just getting the value works!
System.out.println(channel.get());
When doing the same with a typed channel things work:
Channel<Double> channel = context.createChannel("ARIDI-PCT:CURRENT", Double.class);
channel.connectAsync().get(1, TimeUnit.SECONDS);
System.out.println(channel.get(Timestamped.class));
The Example program does not currently (CA release 1.2.2) work and in many cases it is not clear to me the intention of the code.
This task is to at least get it going again.
We should introduce the ability to annotate Channel declarations.
There should be a way to create/connect and close all of those channels within an object with annotations.
Macro substitution need to be implemented for this for sure.
While getting the property nativeType from a channel the return value is a number
It would be great if it would return the actual Java type:
channel.getProperties().get("nativeType")
6
ideally this would be
channel.getProperties().get("nativeType")
Double.class
or something like this ...
or is there a way to map the number to the type?
Should I be using Channel Access Java (CAJ) or this library. Is this library production ready? Is anyone using it? By the way the name "ca" is so generic it is tricky to search for. Maybe you should have given this library a clever name like CAJ2.
Get rid of all javadoc warnings .
Note: the goal here is to stop the stream of (over 100) ugly warning messages that get emitted when building the project. Writing good javadoc takes time and is hard. This issue does not seek to address that, but purely to improve things to the point where the build proceeds quietly. This will be accomplished by making small tweaks to the code. Unfortunately without a deep understanding of the underlying implementation it may sometimes be necessary to do things like this:
@param myThingy the thingy of mine.
One can argue that this is meaningless ! In time it is hoped that we can improve the Javadoc so that it provides something meaningful.
Whist working on PSI's wica project it was observed that caget bulk operations failed under certain circumstances. When the issue arose the following message was logged to the console:
Jun 01, 2018 12:35:40 AM org.epics.ca.impl.ResponseHandlers handleResponse
WARNING: Invalid response message (command = 13876) received from: /192.168.0.25:5064
Jun 01, 2018 12:35:40 AM org.epics.ca.impl.ResponseHandlers handleResponse
WARNING: Invalid response message (command = 12544) received from: /192.168.0.25:5064
Jun 01, 2018 12:35:40 AM org.epics.ca.impl.ResponseHandlers handleResponse
This tracker is to investigate and fix the problem.
To be consistent in naming channel.connect() should be renamed to channel.connectAsync() and there should be a new function named connect with does the blocking connect (i.e. channel.connectAsync().get())
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.