thread support

Ronald Klop ronald-freebsd8 at klop.yi.org
Thu Jun 20 08:18:56 UTC 2013


On Thu, 20 Jun 2013 10:06:25 +0200, Jason Helfman <jgh at freebsd.org> wrote:

> On Thu, Jun 20, 2013 at 12:25 AM, Ronald Klop
> <ronald-freebsd8 at klop.yi.org>wrote:
>
>> On Thu, 20 Jun 2013 02:03:15 +0200, Jason Helfman <jgh at freebsd.org>  
>> wrote:
>>
>>  On Wed, Jun 19, 2013 at 5:02 PM, Jason Helfman <jgh at freebsd.org> wrote:
>>>
>>>  Hi,
>>>>
>>>> I have a new port that I am maintaining, and I wanted to try a  
>>>> feature of
>>>> it, but get the following error:
>>>>
>>>> Exception in thread "main" java.lang.**UnsupportedOperationException:
>>>> Thread
>>>> CPU Time Measurement is not supported.
>>>>
>>>> Any thoughts/ideas on this?
>>>>
>>>> Thanks!
>>>> -jgh
>>>>
>>>> --
>>>> Jason Helfman          | FreeBSD Committer
>>>> jgh at FreeBSD.org     | http://people.freebsd.org/~jgh  | The Power to
>>>> Serve
>>>>
>>>>
>>> I am using openjdk6.
>>>
>>> -jgh
>>>
>>
>>
>> Do you have the complete stacktrace?
>>
>> Ronald.
>>
>>
> Exception in thread "main" java.lang.UnsupportedOperationException:
> Thread CPU Time Measurement is not supported.
> 	at sun.management.ThreadImpl.getThreadCpuTime(ThreadImpl.java:214)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at  
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:616)
> 	at  
> com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:180)
> 	at  
> com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:114)
> 	at  
> com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:51)
> 	at  
> com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:226)
> 	at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
> 	at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:251)
> 	at javax.management.StandardMBean.invoke(StandardMBean.java:405)
> 	at  
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:857)
> 	at  
> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:795)
> 	at  
> javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1475)
> 	at  
> javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
> 	at  
> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1316)
> 	at  
> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)
> 	at  
> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:838)
> 	at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
> 	at  
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:616)
> 	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
> 	at sun.rmi.transport.Transport$1.run(Transport.java:177)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
> 	at  
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
> 	at  
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
> 	at  
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
> 	at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> 	at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>
> at java.lang.Thread.run(Thread.java:679)
>
> -jgh

I already expected JMX was in it. I'm not a developer of the jdk ports for  
FreeBSD, but not all JMX interfaces are implemented. (They are not used  
that often. I think mostly in development tools, like debuggers/profilers.)
You could try implementing sun.management.ThreadImpl.getThreadCpuTime.  
Maybe first a dummy one which always returns the same value to get your  
port going.
If it is implemented in openjdk7 it might be easy to copy to openjdk6.

Maybe other people on the list can help you more with the internals of  
openjdk.

Regards,
Ronald.


More information about the freebsd-java mailing list