Hi,
I have two jars extensions-shared.jar and extension.jar
extension-shared.jar contains model classes and google guava library jar, this is placed under extensions/__lib__
extension.jar contains the extension code referencing guava library (such as Lists.newArrayList(getParentExtension().getUserList()) )
whenever a line of code referencing the guava library executes, the extension logic becomes stuck (i.e. the extension program stops executing anymore)
no errors, etc. printed to logs.
I can successfully connect to admin interface during the problem, no unusual actiivty is present.
Hovever, most of the cpu time looks like being spent in a thread called DestroyJavaVM ( is this normal )?
any thoughts related to cause?
note: when I use ArrayList, etc. (corresponding JVM classes directly) or execute the logic with Guava libraries outside of SFS, there are no problems.
so, it is highly probable that this is not a logic error on my side
SFS2X guava library problem (probably classloader prob.)
Re: SFS2X guava library problem (probably classloader prob.)
That is weird!
The DestroyJavaVM thread should never be busy unless the JVM is shutting down.
http://stackoverflow.com/questions/5766 ... dispatcher
Are you sure you aren't getting any errors whatsoever in the logs?
Why would you do this? You are already getting a List... why duplicating it?
The DestroyJavaVM thread should never be busy unless the JVM is shutting down.
http://stackoverflow.com/questions/5766 ... dispatcher
Are you sure you aren't getting any errors whatsoever in the logs?
such as Lists.newArrayList(getParentExtension().getUserList())
Why would you do this? You are already getting a List... why duplicating it?
Re: SFS2X guava library problem (probably classloader prob.)
You are right with the DestroyJavaVM thread, as time goes by its time utilization ratio decreases
(so, I'm guessing it's not working and the high utilization is related to the way statistics about threads are gathered)
No errors, at all, I checked every single place that can contain a log
According to the method signatures, getParentZone().getUserList() returns Collection<User>,
however, send(...) methods expect List<User>. you can't always assume that a collection is also
a list; if it is the case for these method calls I would be more than happy to use the return value of
getParentZone().getUserList() directly in the send(...) methods
Thanks & Regards
(so, I'm guessing it's not working and the high utilization is related to the way statistics about threads are gathered)
No errors, at all, I checked every single place that can contain a log
According to the method signatures, getParentZone().getUserList() returns Collection<User>,
however, send(...) methods expect List<User>. you can't always assume that a collection is also
a list; if it is the case for these method calls I would be more than happy to use the return value of
getParentZone().getUserList() directly in the send(...) methods
Thanks & Regards
Re: SFS2X guava library problem (probably classloader prob.)
By the way, the Guava problem is also solved with the solution from: http://www.smartfoxserver.com/forums/viewtopic.php?f=18&t=14690
My question about whether the collection returned by getParentZone().getUserList() is backed by something that also implements the List interface still stands, though
Thanks and Regards
My question about whether the collection returned by getParentZone().getUserList() is backed by something that also implements the List interface still stands, though
Thanks and Regards
Re: SFS2X guava library problem (probably classloader prob.)
Hi.
When you do Zone.getUserList() it returns an ArrayList of users.
When you do Zone.getUserList() it returns an ArrayList of users.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: SFS2X guava library problem (probably classloader prob.)
To expand rjgtav's answer a little more:
the methods returning groups of Users or Rooms use the Collection supertype because at times a List is used and some other times a Set is used instead depending on the case.
We should probably document this better, so that type casting is straightforward. In any case it takes just a few seconds to simply try casting the collection to either List or Set. If no error arises you can be assured that you have a List (or Set) in your hand, and this will never change.
Typecasting will also avoid the creation of another list which can be a little resource-consuming when the returned collection contains thousands of elements.
Hope it helps
the methods returning groups of Users or Rooms use the Collection supertype because at times a List is used and some other times a Set is used instead depending on the case.
We should probably document this better, so that type casting is straightforward. In any case it takes just a few seconds to simply try casting the collection to either List or Set. If no error arises you can be assured that you have a List (or Set) in your hand, and this will never change.
Typecasting will also avoid the creation of another list which can be a little resource-consuming when the returned collection contains thousands of elements.
Hope it helps
Who is online
Users browsing this forum: No registered users and 113 guests