473,426 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,426 software developers and data experts.

Java Class.forName slowed down due to Xml Annotations?

1
I have a very large program that loops through about a thousand class strings and does Class.forName(...) on them. It is taking about 100+ milliseconds to execute forName(...) on the classes that have the annotation @XmlAccessorType(XmlAccessType.NONE) and @XmlAttribute/@XmlElement tags on the class members. The classes that are not serializable to xml load in 0-5 milliseconds. I was wondering if any knew what that would be and if there is anyway to speed up the Class.forName(...) calls on these classes.

Thanks

Max
Aug 18 '10 #1
1 1562
Oralloy
988 Expert 512MB
Does this happen for each problematic class instance, or only the first one?

Just pulling this out of the ether, but here goes....

The reason I'm asking is that when you load a class with one of the @XmlAccessorType annotations, it's going to force loading the XmlAccessorType class and its dependencies. If that class tree is complicated, it might be what's slowing down your load.

You might try pre-loading XmlAccessorType, XmlAccessType, XmlAccessor, and XmlElement classes and maintainhandles to their class objects, so they don't unloaded. I don't know if it'll help or not.
Aug 18 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Fu Bo Xia | last post by:
the java.lang.Object.forName method takes a java class name and returns a Class object associated with that class. eg. Class myClass = Object.forName("java.lang.String"); by if i only know the...
0
by: Phoneix | last post by:
Hello , I have a necessity to delete a jar file which is in the CLASSPATH. But JVM locks it after a class.forName() call, even though the class loaded is NOT in the JAR file I want to delete. ( I...
14
by: Alex Hunsley | last post by:
Does python provide a way to dynamically use modules and/or classes? I'm thinking in the vein of Java's Class.forName. As a pseudocode example, I'm looking for the following ability: ...
0
by: romicva | last post by:
I've recently upgraded from 8.1.4 to 8.2.3. System slowed down noticebly. Explain shows that indexes are not used. I did reorgs on indexes and tables, collected stats on key fields with detail...
16
by: Manuel | last post by:
hi, In the past I made the question "how to implement a simple class forname". I made this finally and it compiled well. but now when i execute the program, it crash with a sigsegv. The code...
2
by: jean-francois | last post by:
In java you can do it with Class.forName("myClass").newInstance(); this will return you a new instance of the class myClass, provided that you defined it elsewhere. How can I get this in c++...
4
by: shed | last post by:
Hi, is there something in javascript like Class.forName in Java? I have the name of my Objectname as String so I can't use the keyword new! Thanks, shed
1
by: Sergei Riaguzov | last post by:
Is there a way to create an instance of a class SomeClass in PHP having a string "SomeClass"? The idea is to create instances on classes based on dynamic information obtained from $_POST. Like ...
0
by: asti1987 | last post by:
I have a big problem, y need to print a jasper report, but it must to be with jsp. this is my jsp please help me <%@ page...
0
mickey0
by: mickey0 | last post by:
Hello, I wrote this and it doens't find the proper path: String userDir = System.getProperty("user.dir"); Class c = Class.forName(userDir + "\\" + "Page"); either: Class c =...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.