Re: [jgroups-dev] use of java.util.concurrent in jgroups

Bela Ban <[email protected]> Mon, 10 Jan 2011 09:01:08 +0100
Newsgroups gmane.comp.java.javagroups.devel
Message-ID <[email protected]>
Hi Yann,

I copied the dev list, maybe others can pitch in, too.

Comments inline

On 1/9/11 8:16 PM, Yann Sionneau wrote:
> Hello again,
>
> BPING seems to be working, i ported the master branch to android and it
> seems i can use it with android 2.3 (on my HTC Desire) !


Excellent !


> I can see the broadcast udp "pings" with wireshark which is super great :)
>
> I have another device, to communicate with, but an older one, a HTC hero
> using android 2.1 (google api v7)
>
> This android 2.1 seems more limited and has less functions (for example
> there is no java.net.NetworkInterface.isUp() function, i had to remove a
> if/else statement in jgroups to make it work)


OK.


> Moreoever some java.util.concurrent functions are missing which make the
> application fail on the device at runtime


Couldn't you use the


> http://developer.android.com/reference/java/util/concurrent/package-summary.html
> here are the function allowed by google api v7 (you have to check the
> checkbox at the top right corner "Filter by API Level:" and select "7"
>
> So for example i have these errors :
>
> E/dalvikvm( 1366): Could not find class
> 'java.util.concurrent.ConcurrentSkipListMap', referenced from method
> org.jgroups.util.TimeScheduler2.<init>
> W/dalvikvm( 1366): VFY: unable to resolve new-instance 262
> (Ljava/util/concurrent/ConcurrentSkipListMap;) in
> Lorg/jgroups/util/TimeScheduler2;
> D/dalvikvm( 1366): VFY: replacing opcode 0x22 at 0x0004
> D/dalvikvm( 1366): Making a copy of
> Lorg/jgroups/util/TimeScheduler2;.<init> code (180 bytes)
> E/dalvikvm( 1366): Could not find class
> 'java.util.concurrent.ConcurrentSkipListMap', referenced from method
> org.jgroups.util.TimeScheduler2.<init>
> W/dalvikvm( 1366): VFY: unable to resolve new-instance 262
> (Ljava/util/concurrent/ConcurrentSkipListMap;) in
> Lorg/jgroups/util/TimeScheduler2;
> D/dalvikvm( 1366): VFY: replacing opcode 0x22 at 0x0004
> D/dalvikvm( 1366): Making a copy of
> Lorg/jgroups/util/TimeScheduler2;.<init> code (180 bytes)
> E/dalvikvm( 1366): Could not find class
> 'java.util.concurrent.ConcurrentSkipListMap', referenced from method
> org.jgroups.util.TimeScheduler2.<init>
> W/dalvikvm( 1366): VFY: unable to resolve new-instance 262
> (Ljava/util/concurrent/ConcurrentSkipListMap;) in
> Lorg/jgroups/util/TimeScheduler2;
> D/dalvikvm( 1366): VFY: replacing opcode 0x22 at 0x0004
> D/dalvikvm( 1366): Making a copy of
> Lorg/jgroups/util/TimeScheduler2;.<init> code (168 bytes)
> I/dalvikvm( 1366): Could not find method
> java.util.concurrent.ConcurrentSkipListMap.headMap, referenced from
> method org.jgroups.util.TimeScheduler2._run
> W/dalvikvm( 1366): VFY: unable to resolve virtual method 986:
> Ljava/util/concurrent/ConcurrentSkipListMap;.headMap
> (Ljava/lang/Object;Z)Ljava/util/concurrent/ConcurrentNavigableMap;
>
> and so on ...
>
> As it's written on the API documentation on the page I quoted before,
> the java.util.concurrent.ConcurrentSkipListMap() function does not exist
> on API v7 :/
>
> Is there a mean to disactivate the use of java.util.concurrent ?


I'm afraid not; j.u.c is used throughout JGroups !


> By using only one thread for the all Protocol Stack.
>
> I tried to set several thread-related options to "false" in the xml
> configuration file without any success.
> As well as setting min_thread_nb AND max_thread_nb to 1
>
>
> Or maybe I can rewrite the TimeScheduler to wipe out all the references
> to ConcurrentSkipListMap and use maybe ConcurrentNavigableMap instead ?


You could use a different timer, by saying timer_type="old" or "wheel" 
(in UDP), you could use the old timer (based on ConcurrentHashMap) or 
the wheel based timer, based on a ring buffer. Both don't use 
ConcurrentSkipListMap



-- 
Bela Ban
Lead JGroups / Clustering Team
JBoss

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Javagroups-development mailing list