Whenever a question pops up on SO about Java synchronization, some people are very eager to point out that synchronized(this) should be avoided. Instead, they claim, a lock on a private reference is to be preferred.
Some of the given reasons are:
some evil code may steal your lock (very popular this one, also has an "accidentally" var...
Currently I am evaluating number of web service frameworks in Java. I need web service framework that will help me to expose some functionality of existent application running on JBoss, The application is mostly developed using Spring and POJOs (no EJBs).
What I need is a framework having following properties:
It should provide tools ...
I'm looking for a piece of code which behaves a bit like a singleton but isn't (because singleton's are bad :) What I'm looking for must meet these goals:
Thread safe
Simple (Understand & use, i.e. few lines of code. Library calls are OK)
Fast
Not a singleton; for tests, it must be possible to overwrite the value (and reset it after th...
Is there a way to get the name of the currently executing method in Java?
...
For a project I have a specification with formulas, I have to implement. In these formulas a cumulative standard normal distribution function exists, that takes a float and outputs a probability. The function is symbolized by a Φ. Exists a Java-library, that computes this function?
...
sadly Java Classes can be decompiled pretty well, how can I protect my database if I have to use the login data in the code?
...
I wish to set up a ActiveMQ instance (primarily as a STOMP server) which will service requests from two types of clients:
authenticated users which can read and write to topics
non-authenticated users which can only read from topics
I have been using the SimpleAuthenticationBroker so far and I cannot see anyway to configure the above...
I needed to convert a Java 1.5se app to C# 2.0.
Does anyone know of a tool (preferably free/open source) to do this?
...
I've been tasked with investigating licence server vendors.
(Note: licence servers, or "key servers", are a type of "software copy protection" wherein copies of software deployed to a site call a central licence server to see if they're allowed to run. This is more than just a licence key generation/verification algorithm!)
We need a l...
I've been trying to make sense of the BouncyCastle cryptography APIs for Java. Unfortunately, I'm finding Java cryptography in general to be so obscured by service provider interfaces and jargon that I can't wrap my head around what anything actually does. I've tried reading the necessary documentation repeatedly but it just stays incomp...
I'm working on a statement scanner for our updater (looking for statements that will cause problems with synchronized data) and I need to know which TSQL data types get resolved as Types.VARCHAR and which ones resolve to Types.LONGVARCHAR when you invoke DatabaseMetaData.getColumns()?
...
This is probably quite basic, so bear with me (on the other hand there's probably a nice shiny cut-and-dried answer!).
I'm diagnosing a deadlocking problem at the moment, and indeed I can see that one of my sessions is being blocked by another. (The other end of the deadlock are Java threads waiting on each other in the opposite order....
Lets say you have interface definition.
That interface can be Operation.
Then you have two applications running in different JVMs and communicating somehow remotely by exchanging Operation instances.
Lets call them application A and application B.
If application A implements Operation with the class that is not available in the clas...
I'll try to better explain my problem.
Using Eclipse and MTJ (Mobile Tools for Java) plugin you can set some directives for the preprocessor in order to create different builds of your code, like in C/C++.
My problem is that i'm unable to use this feature. I mean, when i build my sources, the resulting output contains every line of code,...
If I reference the SnakeYAML jar directly from a test program (see bottom), everything works. If I'm inside my Maven-created project, I get the following output from my unit tests:
java.lang.NoSuchMethodError: java.util.LinkedList.push(Ljava/lang/Object;)V
at org.yaml.snakeyaml.scanner.ScannerImpl.addIndent(ScannerImpl.java:482)
...
I am using JAXP to generate and parse an XML document from which some fields are loaded from a database.
Code to serialize the XML:
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.newDocument();
Element root = doc.createElement("test");
root.setAttribute("version", text);
doc....
I'd like for a subclass of a certain superclass with certain constructor parameters to load an XML file containing information that I'd then like to pass to the superconstructor. Is this impossible to achieve?
...
Given a Dataset XSD file, is it possible to generate java classes, that don't make use of System.Data?
I've tried running a test using JAXB's XJC tool, but it doesn't produce anything terribly useful.
Update: I've tried XmlBeans also, following Fernando's suggestion, and it generates something similar to the XJC output - that is, class ...
Hi,
What is the best way to convert a JSON code as this:
{ "data" : { "field1" : "value1", "field2" : "value2"}}
in a Java Map in which one the keys are (field1, field2) and the values for those fields are (value1, value2).
Any ideas? Should I use Json-lib for that? Or better if I write my own parser?
Thanks in advance.
...
I have two processes written in java in two machines within my network that should pass simple chunks of data to each other.
I'm looking for a quick and dirty way (without resorting to writing files and polling for changes on network share files)
...