java

How Many Java HttpURLConnections Should I Be Able to Open Concurrently?

I'm writing a multi-threaded Java web crawler. From what I understand of the web, when a user loads a web page the browser requests the first document (eg, index.html) and as it receives the HTML it will find other resources that need to be included (images, CSS, JS) and ask for those resources concurrently. My crawler is only requestin...

@OneToOne getting returned as ManyToOneType

I have the following POJO: public class SampleBean1 { @Id @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid") protected String id; @OneToOne(cascade=CascadeType.ALL) @JoinColumn(name="OneToOneID") protected SampleBean1 oneToOne; @OneToMany(cascade=Casca...

Is there a parallel processing implementation of HashMap available to Java? Is it even possible?

Searching for the magic ParallelHashMap class More succinctly, can you use multiple threads to speed up HashMap lookups? Are there any implementations out there that do this already? In my project, we need to maintain a large map of objects in memory. We never modify the map after it is created, so the map is strictly read-only. Howeve...

Spring Security Child Thread Context

Hi everyone, So I'm working on this Spring MVC application using Spring Security. I've been hitting a performance problem in some instances where my controller is taking way too long to respond. This is due to a processing method that can take a huge amount of data in to process, based on some user input. Now I've been tweaking the c...

How is the == operator implemented in Java?

Specifically, in the case of object reference equality, what does the == operator do? Does the comparison return true if the references evaluate to the same object address at the time of comparison? Or does it utilize the hashCode value of the two references to determine if the objects are the same? To be very specific here, I would li...

session id cookie in gwt rpc

Assuming I'm rolling my own session code, what's the right way to generate a unique and secure session id cookie in java. Should I not be rolling my own but using something that's already been standardized? I'm using gwt and the google app-engine platform. How do I make sessions persist across browser/server restarts? ...

TZ Var to Java TimeZone?

I need to convert from the Unix TZ variable of the form: stdoffset[dst[offset][,start[/time],end[/time]]] into a Java TimeZone object. For example, convert AEST-10AEDT-11,M10.1.0/02:00:00,M4.1.0/03:00:00 into a Java TimeZone object that represents "Australia\Sydney". Before I go and write the code myself I'd like to know I'm not inventi...

What's with all the Java Build tools?

what's the point of using ant, maven, and buildr? won't the using build in eclipse or netbeans work fine? i'm just curious as to what makes the build tools so special ...

How to integrate Webcam in Swing application of Java ?

I am creating one GUI application in swing Java.I have to integrate web cam with my GUI. Any body have idea about this ? ...

JAVA's System.currentTimeMillis() or C#'s Environment.TickCount?

Hey, as of lately, I've been trying to find good ways to smoothen out thread sleeps (incase it gets disturbed or if your computer laggs etc). So which is an overall "better performance" method? JAVA's System.currentTimeMillis() method for C#: public static double GetCurrentMilliseconds() { DateTime staticDate = new DateTime(1970, ...

Java: Fade out music

Hello, I'm making a game. Now if my player goes to another level the music is still playing. Now I want to let the music fade out to let start the new music of the next level. I use mp3 to play. With the packages: jl1.0, mp3spi1.9.4, tritonus_share-0.3.6. Oh yeah. Volume is not supported in the FloatControll class. Sorry for my bad En...

Spring Framework Events

I was reading through spring framework documentation and found a section on raising events in Spring using ApplicationContext. After reading few paragraphs I found that spring events are raised synchronously. Is there any way to raise asynchronous events? your help is much appreciated. I am looking something similar which would help me t...

Can I inject an interface subtype in Spring?

It doesn't seem to be working right now. I get a java.lang.NullPointerException I have a class that implements an interface public class LearnerDao implements BaseDao { private BaseDao dao; public void setDao(BaseDao dao) { this.dao=dao; } . . . } This is my wiring <bean id="pm" factory-bean="pmf" facto...

Wizard creation and Launching

Hi everyone, How can I launch a wizard on a textPane that serves as my composition panel, whenever I drag and drop a component(file) into the contentPane? I have tried to develop a component whose properties will be diplayed on the composition panel(represented by a JTextPane), in any wizard of my choice. Thanks ...

Java Condition Operators Speed vs Versions of Hotspot VM

Hi, Please consider the following java source: package com.stackoverflow; public class CondSpeed { private static final long COUNT = 1000000000; private static final long OUTER_COUNT = 15; private static long notEqOperator = 0L; private static long notOperator = 0L; private static long equalsFalse = 0L; public CondSpeed() { ...

what software can help me to unwar a war file and get the java source code within it ?

what software can help me to unwar a war file and get the java source code within it ? ...

what is the best software to decompile a java class file ?

I need to batch decompile many class files. ...

Hibernate not throwing exception when openSession is called and the connection to DB cannot be established

When I configure hibernate to connect to a DB and for some reason the connection fails, I noticed that it doesnt throw any exception neither when building the factory (which is acceptable) nor when I call sessionFactory.openSession() (which is less acceptable). What is more annoying is that session.isConnected() returns true after I call...

TWUIK / ant / Hello World

Hi, I'm trying to run the Hello World example of the TWUIK SDK. Unfortunately ant aborts with the following error message: Sorry, could not proceed. Please check if your SDK stub is supplied in your arguments' list. How can I specify it? Thanks. ...

How to fill HTTP forms through java?

I want to fill a text field of a HTTP form through java and then want to click on the submit button through java so as to get the page source of the document returned after submitting the form. I can do this by sending HTTP request directly but I don't to this in this way. Very Urgent. You can also paste the code or demo code to explain...